Zoey76 9 роки тому
батько
коміт
890bca580d

+ 1 - 1
L2J_Server/java/com/l2jserver/gameserver/ai/AbstractAI.java

@@ -52,7 +52,7 @@ import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
  */
  */
 public abstract class AbstractAI implements Ctrl
 public abstract class AbstractAI implements Ctrl
 {
 {
-	protected static final Logger _log = LoggerFactory.getLogger(AbstractAI.class.getName());
+	protected static final Logger _log = LoggerFactory.getLogger(AbstractAI.class);
 	
 	
 	private NextAction _nextAction;
 	private NextAction _nextAction;
 	
 	

+ 9 - 8
L2J_Server/java/com/l2jserver/gameserver/cache/HtmCache.java

@@ -24,8 +24,9 @@ import java.io.FileInputStream;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 import com.l2jserver.Config;
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.gameserver.util.Util;
@@ -36,9 +37,9 @@ import com.l2jserver.util.file.filter.HTMLFilter;
  */
  */
 public class HtmCache
 public class HtmCache
 {
 {
-	private static final Logger _log = Logger.getLogger(HtmCache.class.getName());
+	private static final Logger _log = LoggerFactory.getLogger(HtmCache.class);
 	
 	
-	private static final HTMLFilter htmlFilter = new HTMLFilter();
+	private static final HTMLFilter HTML_FILTER = new HTMLFilter();
 	
 	
 	private static final Map<String, String> _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>();
 	private static final Map<String, String> _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>();
 	
 	
@@ -109,7 +110,7 @@ public class HtmCache
 	
 	
 	public String loadFile(File file)
 	public String loadFile(File file)
 	{
 	{
-		if (!htmlFilter.accept(file))
+		if (!HTML_FILTER.accept(file))
 		{
 		{
 			return null;
 			return null;
 		}
 		}
@@ -139,7 +140,7 @@ public class HtmCache
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Problem with htm file " + e.getMessage(), e);
+			_log.warn("Problem with htm file {}!", file, e);
 		}
 		}
 		return content;
 		return content;
 	}
 	}
@@ -150,7 +151,7 @@ public class HtmCache
 		if (content == null)
 		if (content == null)
 		{
 		{
 			content = "<html><body>My text is missing:<br>" + path + "</body></html>";
 			content = "<html><body>My text is missing:<br>" + path + "</body></html>";
-			_log.warning("Cache[HTML]: Missing HTML page: " + path);
+			_log.warn("Cache[HTML]: Missing HTML page: " + path);
 		}
 		}
 		return content;
 		return content;
 	}
 	}
@@ -204,7 +205,7 @@ public class HtmCache
 	 */
 	 */
 	public boolean isLoadable(String path)
 	public boolean isLoadable(String path)
 	{
 	{
-		return htmlFilter.accept(new File(Config.DATAPACK_ROOT, path));
+		return HTML_FILTER.accept(new File(Config.DATAPACK_ROOT, path));
 	}
 	}
 	
 	
 	public static HtmCache getInstance()
 	public static HtmCache getInstance()

+ 9 - 8
L2J_Server/java/com/l2jserver/gameserver/communitybbs/BB/Forum.java

@@ -25,16 +25,17 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
 import com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager;
 import com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 
 
-public class Forum
+public final class Forum
 {
 {
-	private static final Logger _log = Logger.getLogger(Forum.class.getName());
+	private static final Logger _log = LoggerFactory.getLogger(Forum.class);
 	
 	
 	// type
 	// type
 	public static final int ROOT = 0;
 	public static final int ROOT = 0;
@@ -111,7 +112,7 @@ public class Forum
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
+			_log.warn("Could not get from database forum ID {}!", _forumId, e);
 		}
 		}
 		
 		
 		try (Connection con = ConnectionFactory.getInstance().getConnection();
 		try (Connection con = ConnectionFactory.getInstance().getConnection();
@@ -133,7 +134,7 @@ public class Forum
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
+			_log.warn("Could not get from database topics for forum ID {}", _forumId, e);
 		}
 		}
 	}
 	}
 	
 	
@@ -155,7 +156,7 @@ public class Forum
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e);
+			_log.warn("Could not get from database child forums for forum ID {}", _forumId, e);
 		}
 		}
 	}
 	}
 	
 	
@@ -232,7 +233,7 @@ public class Forum
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Error while saving new Forum to db " + e.getMessage(), e);
+			_log.error("Could not save forum ID {} in database!", _forumId, e);
 		}
 		}
 	}
 	}
 	
 	

+ 9 - 8
L2J_Server/java/com/l2jserver/gameserver/communitybbs/BB/Post.java

@@ -23,8 +23,9 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSet;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
 import com.l2jserver.gameserver.communitybbs.Manager.PostBBSManager;
 import com.l2jserver.gameserver.communitybbs.Manager.PostBBSManager;
@@ -34,7 +35,7 @@ import com.l2jserver.gameserver.communitybbs.Manager.PostBBSManager;
  */
  */
 public class Post
 public class Post
 {
 {
-	private static Logger _log = Logger.getLogger(Post.class.getName());
+	private static final Logger _log = LoggerFactory.getLogger(Post.class);
 	
 	
 	public static class CPost
 	public static class CPost
 	{
 	{
@@ -93,7 +94,7 @@ public class Post
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
+			_log.warn("Could not save post ID {} in database!", cp.postId, e);
 		}
 		}
 	}
 	}
 	
 	
@@ -114,7 +115,7 @@ public class Post
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e);
+			_log.warn("Unable to delete post for topic ID {} in forum ID {} from database!", t.getForumID(), t.getID(), e);
 		}
 		}
 	}
 	}
 	
 	
@@ -146,7 +147,7 @@ public class Post
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e);
+			_log.warn("Unable to get post from topic ID {} in forum ID {} from database!", t.getForumID(), t.getID(), e);
 		}
 		}
 	}
 	}
 	
 	
@@ -155,10 +156,10 @@ public class Post
 	 */
 	 */
 	public void updatetxt(int i)
 	public void updatetxt(int i)
 	{
 	{
+		final CPost cp = getCPost(i);
 		try (Connection con = ConnectionFactory.getInstance().getConnection();
 		try (Connection con = ConnectionFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
 			PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
 		{
 		{
-			CPost cp = getCPost(i);
 			ps.setString(1, cp.postTxt);
 			ps.setString(1, cp.postTxt);
 			ps.setInt(2, cp.postId);
 			ps.setInt(2, cp.postId);
 			ps.setInt(3, cp.postTopicId);
 			ps.setInt(3, cp.postTopicId);
@@ -167,7 +168,7 @@ public class Post
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
+			_log.warn("Unable to store post ID {} in database!", cp.postId, e);
 		}
 		}
 	}
 	}
 }
 }

+ 6 - 5
L2J_Server/java/com/l2jserver/gameserver/communitybbs/BB/Topic.java

@@ -20,15 +20,16 @@ package com.l2jserver.gameserver.communitybbs.BB;
 
 
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 
 
 public class Topic
 public class Topic
 {
 {
-	private static final Logger _log = Logger.getLogger(Topic.class.getName());
+	private static final Logger _log = LoggerFactory.getLogger(Topic.class);
 	
 	
 	public static final int MORMAL = 0;
 	public static final int MORMAL = 0;
 	public static final int MEMO = 1;
 	public static final int MEMO = 1;
@@ -89,7 +90,7 @@ public class Topic
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Error while saving new Topic to db " + e.getMessage(), e);
+			_log.warn("Error while saving new Topic to database!", e);
 		}
 		}
 	}
 	}
 	
 	
@@ -141,7 +142,7 @@ public class Topic
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.WARNING, "Error while deleting topic: " + e.getMessage(), e);
+			_log.warn("Error while deleting topic ID {} from database!", getID(), e);
 		}
 		}
 	}
 	}