浏览代码

logging rework, getting rid of printStackTrace(), part 2

janiii 15 年之前
父节点
当前提交
8bd87b04e9
共有 35 个文件被更改,包括 287 次插入528 次删除
  1. 2 11
      L2_GameServer/java/com/l2jserver/gameserver/GameServer.java
  2. 3 8
      L2_GameServer/java/com/l2jserver/gameserver/TradeController.java
  3. 2 1
      L2_GameServer/java/com/l2jserver/gameserver/model/AutoChatHandler.java
  4. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/model/AutoSpawnHandler.java
  5. 21 47
      L2_GameServer/java/com/l2jserver/gameserver/model/L2Clan.java
  6. 5 12
      L2_GameServer/java/com/l2jserver/gameserver/model/L2UIKeysSettings.java
  7. 5 1
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleTeleporterInstance.java
  8. 8 15
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  9. 3 6
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/Auction.java
  10. 7 13
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/Castle.java
  11. 1 2
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/ClanHall.java
  12. 16 31
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/Fort.java
  13. 145 202
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/FortSiege.java
  14. 3 2
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/L2Event.java
  15. 8 64
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/Siege.java
  16. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java
  17. 4 4
      L2_GameServer/java/com/l2jserver/gameserver/model/olympiad/OlympiadGame.java
  18. 2 1
      L2_GameServer/java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java
  19. 4 4
      L2_GameServer/java/com/l2jserver/gameserver/model/quest/Quest.java
  20. 4 7
      L2_GameServer/java/com/l2jserver/gameserver/model/quest/QuestState.java
  21. 4 2
      L2_GameServer/java/com/l2jserver/gameserver/model/zone/type/L2FortZone.java
  22. 3 4
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/L2GameClientPacket.java
  23. 5 11
      L2_GameServer/java/com/l2jserver/gameserver/network/communityserver/CommunityServerThread.java
  24. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/network/gameserverpackets/BlowFishKey.java
  25. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/L2GameServerPacket.java
  26. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java
  27. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/script/faenor/FaenorEventParser.java
  28. 3 4
      L2_GameServer/java/com/l2jserver/gameserver/script/faenor/FaenorScriptEngine.java
  29. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/script/faenor/FaenorWorldDataParser.java
  30. 3 5
      L2_GameServer/java/com/l2jserver/gameserver/scripting/L2ScriptEngineManager.java
  31. 2 3
      L2_GameServer/java/com/l2jserver/gameserver/taskmanager/KnownListUpdateTaskManager.java
  32. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/taskmanager/TaskManager.java
  33. 4 48
      L2_GameServer/java/com/l2jserver/loginserver/L2LoginServer.java
  34. 2 2
      L2_GameServer/java/com/l2jserver/loginserver/clientpackets/L2LoginClientPacket.java
  35. 2 2
      L2_GameServer/java/com/l2jserver/loginserver/gameserverpackets/BlowFishKey.java

+ 2 - 11
L2_GameServer/java/com/l2jserver/gameserver/GameServer.java

@@ -448,12 +448,7 @@ public class GameServer
 			}
 			catch (UnknownHostException e1)
 			{
-				_log.severe("WARNING: The GameServer bind address is invalid, using all avaliable IPs. Reason: " + e1.getMessage());
-				
-				if (Config.DEVELOPER)
-				{
-					e1.printStackTrace();
-				}
+				_log.log(Level.SEVERE, "WARNING: The GameServer bind address is invalid, using all avaliable IPs. Reason: " + e1.getMessage(), e1);
 			}
 		}
 		
@@ -463,11 +458,7 @@ public class GameServer
 		}
 		catch (IOException e)
 		{
-			_log.severe("FATAL: Failed to open server socket. Reason: " + e.getMessage());
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
+			_log.log(Level.SEVERE, "FATAL: Failed to open server socket. Reason: " + e.getMessage(), e);
 			System.exit(1);
 		}
 		_selectorThread.start();

+ 3 - 8
L2_GameServer/java/com/l2jserver/gameserver/TradeController.java

@@ -162,8 +162,7 @@ public class TradeController
 		catch (Exception e)
 		{
 			// problem with initializing spawn, go to next one
-			_log.warning("TradeController: Buylists could not be initialized.");
-			e.printStackTrace();
+			_log.log(Level.WARNING, "TradeController: Buylists could not be initialized: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -173,7 +172,6 @@ public class TradeController
 			}
 			catch (Exception e)
 			{
-				
 			}
 		}
 		
@@ -272,8 +270,7 @@ public class TradeController
 			catch (Exception e)
 			{
 				// problem with initializing spawn, go to next one
-				_log.warning("TradeController: Buylists could not be initialized.");
-				e.printStackTrace();
+				_log.log(Level.WARNING, "TradeController: Buylists could not be initialized: " + e.getMessage(), e);
 			}
 			finally
 			{
@@ -283,7 +280,6 @@ public class TradeController
 				}
 				catch (Exception e)
 				{
-					
 				}
 			}
 		}
@@ -343,7 +339,7 @@ public class TradeController
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "TradeController: Could not store Count Item");
+			_log.log(Level.SEVERE, "TradeController: Could not store Count Item: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -353,7 +349,6 @@ public class TradeController
 			}
 			catch (Exception e)
 			{
-				e.printStackTrace();
 			}
 		}
 	}

+ 2 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/AutoChatHandler.java

@@ -20,6 +20,7 @@ import java.sql.ResultSet;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ScheduledFuture;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.Config;
@@ -828,7 +829,7 @@ public class AutoChatHandler implements SpawnListener
 					}
 					catch (Exception e)
 					{
-						e.printStackTrace();
+						_log.log(Level.WARNING, "Exception on AutoChatRunner.run(): " + e.getMessage(), e);
 						return;
 					}
 				}

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/AutoSpawnHandler.java

@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.Config;
@@ -557,8 +558,7 @@ public class AutoSpawnHandler
 			}
 			catch (Exception e)
 			{
-				_log.warning("AutoSpawnHandler: An error occurred while initializing spawn instance (Object ID = " + _objectId + "): " + e);
-				e.printStackTrace();
+				_log.log(Level.WARNING, "AutoSpawnHandler: An error occurred while initializing spawn instance (Object ID = " + _objectId + "): " + e.getMessage(), e);
 			}
 		}
 	}

+ 21 - 47
L2_GameServer/java/com/l2jserver/gameserver/model/L2Clan.java

@@ -762,31 +762,16 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on updateClanScoreInDb(): " + e.getMessage(), e);
 		}
 		finally
 		{
-			if (statement != null)
+			try
 			{
-				try
-				{
-					statement.close();
-				}
-				catch (Exception e)
-				{
-					e.printStackTrace();
-				}
+				con.close();
 			}
-			if (con != null)
+			catch (Exception e)
 			{
-				try
-				{
-					con.close();
-				}
-				catch (Exception e)
-				{
-					e.printStackTrace();
-				}
 			}
 		}
 	}
@@ -814,28 +799,17 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error saving clan.", e);
+			_log.log(Level.SEVERE, "Error saving clan: " + e.getMessage(), e);
 		}
 		finally
 		{
-			if (statement != null)
-				try
-				{
-					statement.close();
-				}
-				catch (Exception e)
-				{
-					e.printStackTrace();
-				}
-			if (con != null)
-				try
-				{
-					con.close();
-				}
-				catch (Exception e)
-				{
-					e.printStackTrace();
-				}
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
 		}
 	}
 	
@@ -864,7 +838,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error saving new clan.", e);
+			_log.log(Level.SEVERE, "Error saving new clan: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -906,7 +880,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error removing clan member.", e);
+			_log.log(Level.SEVERE, "Error removing clan member: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -938,7 +912,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error updating clan wars data.", e);
+			_log.log(Level.SEVERE, "Error updating clan wars data: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1031,7 +1005,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error restoring clan data.", e);
+			_log.log(Level.SEVERE, "Error restoring clan data: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1066,7 +1040,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error restoring clan notice.", e);
+			_log.log(Level.SEVERE, "Error restoring clan notice: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1178,7 +1152,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error restoring clan skills.", e);
+			_log.log(Level.SEVERE, "Error restoring clan skills: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1758,7 +1732,7 @@ public class L2Clan
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Error saving sub clan data.", e);
+				_log.log(Level.SEVERE, "Error saving sub clan data: " + e.getMessage(), e);
 			}
 			finally
 			{
@@ -1823,7 +1797,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error saving new sub clan leader.", e);
+			_log.log(Level.SEVERE, "Error saving new sub clan leader: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1868,7 +1842,7 @@ public class L2Clan
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Error restoring clan privs by rank.", e);
+			_log.log(Level.SEVERE, "Error restoring clan privs by rank: " + e.getMessage(), e);
 		}
 		finally
 		{

+ 5 - 12
L2_GameServer/java/com/l2jserver/gameserver/model/L2UIKeysSettings.java

@@ -20,6 +20,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javolution.util.FastList;
@@ -121,8 +122,7 @@ public class L2UIKeysSettings
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: saveInDB(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: saveInDB(): " + e.getMessage(), e);
 		}
 		
 		query = "REPLACE INTO character_ui_actions (`charId`, `cat`, `order`, `cmd`, `key`, `tgKey1`, `tgKey2`, `show`) VALUES";
@@ -147,8 +147,7 @@ public class L2UIKeysSettings
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: saveInDB(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: saveInDB(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -158,8 +157,6 @@ public class L2UIKeysSettings
 			}
 			catch (Exception e)
 			{
-				_log.warning("Exception while closing connection: saveInDB(): " + e.getMessage());
-				e.printStackTrace();
 			}
 		}
 		_saved = true;
@@ -192,8 +189,7 @@ public class L2UIKeysSettings
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: getCatsFromDB(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: getCatsFromDB(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -203,7 +199,6 @@ public class L2UIKeysSettings
 			}
 			catch (SQLException e)
 			{
-				e.printStackTrace();
 			}
 		}
 		
@@ -241,8 +236,7 @@ public class L2UIKeysSettings
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: getKeysFromDB(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: getKeysFromDB(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -252,7 +246,6 @@ public class L2UIKeysSettings
 			}
 			catch (SQLException e)
 			{
-				e.printStackTrace();
 			}
 		}
 		

+ 5 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleTeleporterInstance.java

@@ -16,6 +16,8 @@ package com.l2jserver.gameserver.model.actor.instance;
 
 import java.util.Collection;
 import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.datatables.MapRegionTable;
@@ -31,6 +33,8 @@ import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
  */
 public final class L2CastleTeleporterInstance extends L2Npc
 {
+	public static final Logger _log = Logger.getLogger(L2CastleTeleporterInstance.class.getName());
+	
 	private boolean _currentTask = false;
 
 	/**
@@ -119,7 +123,7 @@ public final class L2CastleTeleporterInstance extends L2Npc
 			}
 			catch (NullPointerException e)
 			{
-				e.printStackTrace();
+				_log.log(Level.WARNING, "" + e.getMessage(), e);
 			}
 		}
 	}

+ 8 - 15
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -1434,8 +1434,7 @@ public final class L2PcInstance extends L2Playable
 		}
 		catch (Exception e)
 		{
-			_log.info("logout(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on logout(): " + e.getMessage(), e);
 		}
 	}
 
@@ -7546,8 +7545,7 @@ public final class L2PcInstance extends L2Playable
             statement.close();
         }
         catch (Exception e) {
-            _log.warning("Could not restore classes for " + player.getName() + ": " + e);
-            e.printStackTrace();
+            _log.log(Level.WARNING, "Could not restore classes for " + player.getName() + ": " + e.getMessage(), e);
         }
         finally {
             try { con.close(); } catch (Exception e) {}
@@ -8205,8 +8203,7 @@ public final class L2PcInstance extends L2Playable
 			statement.close();
 		}
 		catch (Exception e) {
-			_log.warning("Could not restore "+this+" active effect data: " + e);
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Could not restore "+this+" active effect data: " + e.getMessage(), e);
 		}
 		finally {
 			try {con.close();} catch (Exception e) {}
@@ -11994,7 +11991,7 @@ public final class L2PcInstance extends L2Playable
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on deleteMe() changeCommunityBoard: " + e.getMessage(), e);
 		}
 		
 		try
@@ -12004,7 +12001,7 @@ public final class L2PcInstance extends L2Playable
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on deleteMe() notifyFriends: " + e.getMessage(), e);
 		}
 	}
 
@@ -13799,7 +13796,7 @@ public final class L2PcInstance extends L2Playable
 			}
 			catch (Exception e)
 			{
-				e.printStackTrace();
+				_log.log(Level.WARNING, "Exception on dismount(): " + e.getMessage(), e);
 			}
 		}
 	}
@@ -14634,12 +14631,10 @@ public final class L2PcInstance extends L2Playable
 		{
 			try
 			{
-				if (con != null)
-					con.close();
+				con.close();
 			}
 			catch (SQLException e)
 			{
-				e.printStackTrace();
 			}
 		}
 	}
@@ -14673,12 +14668,10 @@ public final class L2PcInstance extends L2Playable
 		{
 			try
 			{
-				if (con != null)
-					con.close();
+				con.close();
 			}
 			catch (SQLException e)
 			{
-				e.printStackTrace();
 			}
 		}
 	}

+ 3 - 6
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Auction.java

@@ -192,8 +192,7 @@ public class Auction
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: Auction.load(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: Auction.load(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -241,8 +240,7 @@ public class Auction
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: Auction.loadBid(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: Auction.loadBid(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -400,8 +398,7 @@ public class Auction
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "Exception: Auction.updateInDB(L2PcInstance bidder, int bid): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "Exception: Auction.updateInDB(L2PcInstance bidder, int bid): " + e.getMessage(), e);
 		}
 		finally
 		{

+ 7 - 13
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Castle.java

@@ -509,7 +509,7 @@ public class Castle
 				}
 				catch (Exception e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception in setOwner: " + e.getMessage(), e);
 				}
 				oldOwner.setHasCastle(0); // Unset has castle flag for old owner
 				for (L2PcInstance member : oldOwner.getOnlineMembers(0))
@@ -723,8 +723,7 @@ public class Castle
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadCastleData(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadCastleData(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -878,8 +877,7 @@ public class Castle
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadCastleDoor(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadCastleDoor(): " + e.getMessage(),e );
 		}
 		finally
 		{
@@ -913,8 +911,7 @@ public class Castle
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadCastleDoorUpgrade(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadCastleDoorUpgrade(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -941,8 +938,7 @@ public class Castle
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: removeDoorUpgrade(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: removeDoorUpgrade(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -972,8 +968,7 @@ public class Castle
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: saveDoorUpgrade(int doorId, int hp, int pDef, int mDef): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: saveDoorUpgrade(int doorId, int hp, int pDef, int mDef): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1029,8 +1024,7 @@ public class Castle
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage(), e);
 		}
 		finally
 		{

+ 1 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/entity/ClanHall.java

@@ -567,8 +567,7 @@ public class ClanHall
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage(), e);
 		}
 		finally
 		{

+ 16 - 31
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Fort.java

@@ -300,8 +300,7 @@ public class Fort
 			}
 			catch (Exception e)
 			{
-				_log.warning("Exception: ScheduleSpecialEnvoysSpawn() for Fort: " + _fortInst.getName() + " " + e.getMessage());
-				e.printStackTrace();
+				_log.log(Level.WARNING, "Exception: ScheduleSpecialEnvoysSpawn() for Fort " + _fortInst.getName() + ": " + e.getMessage(), e);
 			}
 		}
 	}
@@ -417,7 +416,7 @@ public class Fort
 			}
 			catch (Exception e)
 			{
-				e.printStackTrace();
+				_log.log(Level.WARNING, "Exception in setOwner: " + e.getMessage(), e);
 			}
 			removeOwner(true);
 		}
@@ -494,8 +493,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: setBloodOathReward(int val): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: setBloodOathReward(int val): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -609,8 +607,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadFortData(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadFortData(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -765,8 +762,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadFortDoor(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadFortDoor(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -804,8 +800,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadFlagPoles(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadFlagPoles(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -840,8 +835,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadFortDoorUpgrade(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadFortDoorUpgrade(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -869,8 +863,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: removeDoorUpgrade(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: removeDoorUpgrade(): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -900,8 +893,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: saveDoorUpgrade(int doorId, int hp, int pDef, int mDef): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: saveDoorUpgrade(int doorId, int hp, int pDef, int mDef): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -971,8 +963,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1085,8 +1076,7 @@ public class Fort
 			}
 			catch (Exception e)
 			{
-				_log.warning("Exception in endFortressSiege " + e.getMessage());
-				e.printStackTrace();
+				_log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e);
 			}
 		}
 		
@@ -1131,8 +1121,7 @@ public class Fort
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: setFortState(int state, int castleId): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: setFortState(int state, int castleId): " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1282,8 +1271,7 @@ public class Fort
 		catch (Exception e)
 		{
 			// problem with initializing spawn, go to next one
-			_log.warning("Fort " + getFortId() + " initNpcs: Spawn could not be initialized: " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Fort " + getFortId() + " initNpcs: Spawn could not be initialized: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1336,8 +1324,7 @@ public class Fort
 		catch (Exception e)
 		{
 			// problem with initializing spawn, go to next one
-			_log.warning("Fort " + getFortId() + " initSiegeNpcs: Spawn could not be initialized: " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Fort " + getFortId() + " initSiegeNpcs: Spawn could not be initialized: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1391,8 +1378,7 @@ public class Fort
 		catch (Exception e)
 		{
 			// problem with initializing spawn, go to next one
-			_log.warning("Fort " + getFortId() + " initNpcCommanders: Spawn could not be initialized: " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Fort " + getFortId() + " initNpcCommanders: Spawn could not be initialized: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -1450,8 +1436,7 @@ public class Fort
 		catch (Exception e)
 		{
 			// problem with initializing spawn, go to next one
-			_log.warning("Fort " + getFortId() + " initSpecialEnvoys: Spawn could not be initialized: " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Fort " + getFortId() + " initSpecialEnvoys: Spawn could not be initialized: " + e.getMessage(), e);
 		}
 		finally
 		{

文件差异内容过多而无法显示
+ 145 - 202
L2_GameServer/java/com/l2jserver/gameserver/model/entity/FortSiege.java


+ 3 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/entity/L2Event.java

@@ -22,6 +22,7 @@ import java.io.InputStreamReader;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.gameserver.datatables.NpcTable;
@@ -168,7 +169,7 @@ public class L2Event
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on showEventHtml(): " + e.getMessage(), e);
 		}
 	}
 	
@@ -208,7 +209,7 @@ public class L2Event
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e);
 		}
 		
 	}

+ 8 - 64
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Siege.java

@@ -678,19 +678,10 @@ public class Siege implements Siegable
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: clearSiegeClan(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: clearSiegeClan(): " + e.getMessage(), e);
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (Exception e)
-			{
-			}
-
 			try
 			{
 				con.close();
@@ -717,19 +708,10 @@ public class Siege implements Siegable
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: clearSiegeWaitingClan(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: clearSiegeWaitingClan(): " + e.getMessage(), e);
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (Exception e)
-			{
-			}
-
 			try
 			{
 				con.close();
@@ -921,19 +903,10 @@ public class Siege implements Siegable
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: removeSiegeClan(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: removeSiegeClan(): " + e.getMessage(), e);
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (Exception e)
-			{
-			}
-
 			try
 			{
 				con.close();
@@ -1175,19 +1148,10 @@ public class Siege implements Siegable
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: loadSiegeClan(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: loadSiegeClan(): " + e.getMessage(), e);
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (Exception e)
-			{
-			}
-
 			try
 			{
 				con.close();
@@ -1214,8 +1178,7 @@ public class Siege implements Siegable
 					}
 					catch (Exception e)
 					{
-						_log.warning("Exception: removeControlTower(): " + e.getMessage());
-						e.printStackTrace();
+						_log.log(Level.WARNING, "Exception: removeControlTower(): " + e.getMessage(), e);
 					}
 				}
 			}
@@ -1240,8 +1203,7 @@ public class Siege implements Siegable
 					}
 					catch (Exception e)
 					{
-						_log.warning("Exception: removeFlamelTower(): " + e.getMessage());
-						e.printStackTrace();
+						_log.log(Level.WARNING, "Exception: removeFlamelTower(): " + e.getMessage(), e);
 					}
 				}
 			}
@@ -1310,19 +1272,10 @@ public class Siege implements Siegable
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: saveSiegeDate(): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: saveSiegeDate(): " + e.getMessage(), e);
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (Exception e)
-			{
-			}
-
 			try
 			{
 				con.close();
@@ -1391,19 +1344,10 @@ public class Siege implements Siegable
 		}
 		catch (Exception e)
 		{
-			_log.warning("Exception: saveSiegeClan(L2Clan clan, int typeId, boolean isUpdateRegistration): " + e.getMessage());
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception: saveSiegeClan(L2Clan clan, int typeId, boolean isUpdateRegistration): " + e.getMessage(), e);
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (Exception e)
-			{
-			}
-
 			try
 			{
 				con.close();

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java

@@ -18,6 +18,7 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.util.List;
+import java.util.logging.Level;
 
 import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
@@ -1643,8 +1644,7 @@ public abstract class Inventory extends ItemContainer
 		}
 		catch (Exception e)
 		{
-			_log.warning("Could not restore inventory :");
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Could not restore inventory: " + e.getMessage(), e);
 		}
 		finally 
 		{

+ 4 - 4
L2_GameServer/java/com/l2jserver/gameserver/model/olympiad/OlympiadGame.java

@@ -610,7 +610,7 @@ class OlympiadGame
 				}
 				catch (Exception e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception on validateWinnder(): " + e.getMessage(), e);
 				}
 				
 			}
@@ -649,7 +649,7 @@ class OlympiadGame
 				}
 				catch (Exception e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception on validateWinnder(): " + e.getMessage(), e);
 				}
 			}
 			else if (_pOneCrash && _pTwoCrash)
@@ -675,7 +675,7 @@ class OlympiadGame
 				}
 				catch (Exception e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception on validateWinnder(): " + e.getMessage(), e);
 				}
 			}
 			playerOneStat.set(COMP_DONE, playerOnePlayed + 1);
@@ -1078,7 +1078,7 @@ class OlympiadGameTask implements Runnable
 				}
 				catch (Exception e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception on portPlayersBack(): " + e.getMessage(), e);
 				}
 			}
 

+ 2 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java

@@ -15,6 +15,7 @@
 package com.l2jserver.gameserver.model.olympiad;
 
 import java.util.Map;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -248,7 +249,7 @@ class OlympiadManager implements Runnable
 							}
 							catch (Exception e)
 							{
-								e.printStackTrace();
+								_log.log(Level.WARNING, "Exception on OlympiadManager.run(): " + e.getMessage(), e);
 							}
 						}
 					}

+ 4 - 4
L2_GameServer/java/com/l2jserver/gameserver/model/quest/Quest.java

@@ -391,7 +391,7 @@ public class Quest extends ManagedScript
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on onSpawn() in notifySpawn(): " + e.getMessage(), e);
 			return true;
 		}
 		return false;
@@ -1255,7 +1255,7 @@ public class Quest extends ManagedScript
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on addEventId(): " + e.getMessage(), e);
 			return null;
 		}
 	}
@@ -1377,7 +1377,7 @@ public class Quest extends ManagedScript
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on addEnterZoneId(): " + e.getMessage(), e);
 			return null;
 		}
 	}
@@ -1395,7 +1395,7 @@ public class Quest extends ManagedScript
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Exception on addExitZoneId(): " + e.getMessage(), e);
 			return null;
 		}
 	}

+ 4 - 7
L2_GameServer/java/com/l2jserver/gameserver/model/quest/QuestState.java

@@ -260,7 +260,7 @@ public final class QuestState
 			}
 			catch (Exception e)
 			{
-				_log.finer(getPlayer().getName() + ", " + getQuestName() + " cond [" + val + "] is not an integer.  Value stored, but no packet was sent: " + e);
+				_log.log(Level.WARNING, getPlayer().getName() + ", " + getQuestName() + " cond [" + val + "] is not an integer.  Value stored, but no packet was sent: " + e.getMessage(), e);
 			}
 		}
 
@@ -408,7 +408,7 @@ public final class QuestState
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, "could not insert player's global quest variable:", e);
+			_log.log(Level.WARNING, "Could not insert player's global quest variable: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -418,7 +418,6 @@ public final class QuestState
 			}
 			catch (Exception e)
 			{
-				e.printStackTrace();
 			}
 		}
 	}
@@ -451,7 +450,7 @@ public final class QuestState
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, "could not load player's global quest variable:", e);
+			_log.log(Level.WARNING, "Could not load player's global quest variable: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -461,7 +460,6 @@ public final class QuestState
 			}
 			catch (Exception e)
 			{
-				e.printStackTrace();
 			}
 		}
 		return result;
@@ -486,7 +484,7 @@ public final class QuestState
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, "could not delete player's global quest variable:", e);
+			_log.log(Level.WARNING, "could not delete player's global quest variable: " + e.getMessage(), e);
 		}
 		finally
 		{
@@ -496,7 +494,6 @@ public final class QuestState
 			}
 			catch (Exception e)
 			{
-				e.printStackTrace();
 			}
 		}
 	}

+ 4 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/zone/type/L2FortZone.java

@@ -14,6 +14,8 @@
  */
 package com.l2jserver.gameserver.model.zone.type;
 
+import java.util.logging.Level;
+
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.datatables.MapRegionTable;
 import com.l2jserver.gameserver.datatables.SkillTable;
@@ -172,7 +174,7 @@ public class L2FortZone extends L2SpawnZone
 				}
 				catch (NullPointerException e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception on onEnter(): " + e.getMessage(), e);
 				}
 			}
 		}
@@ -202,7 +204,7 @@ public class L2FortZone extends L2SpawnZone
 				}
 				catch (NullPointerException e)
 				{
-					e.printStackTrace();
+					_log.log(Level.WARNING, "Exception on updateZoneStatusForCharactersInside(): " + e.getMessage(), e);
 				}
 			}
 		}

+ 3 - 4
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/L2GameClientPacket.java

@@ -15,6 +15,7 @@
 package com.l2jserver.gameserver.network.clientpackets;
 
 import java.nio.BufferUnderflowException;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 
@@ -45,8 +46,7 @@ public abstract class L2GameClientPacket extends ReceivablePacket<L2GameClient>
 		}
 		catch (Exception e)
 		{
-			_log.severe("Client: "+getClient().toString()+" - Failed reading: "+getType()+" - L2J Server Version: "+Config.SERVER_VERSION+" - DP Revision: "+Config.DATAPACK_VERSION);
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed reading: " + getType() + " - L2J Server Version: " + Config.SERVER_VERSION + " - DP Revision: " + Config.DATAPACK_VERSION + " ; " + e.getMessage(), e);
 			
 			if (e instanceof BufferUnderflowException) // only one allowed per client per minute
 			{
@@ -109,8 +109,7 @@ public abstract class L2GameClientPacket extends ReceivablePacket<L2GameClient>
 		}
 		catch (Throwable t)
 		{
-			_log.severe("Client: "+getClient().toString()+" - Failed running: "+getType()+" - L2J Server Version: "+Config.SERVER_VERSION+" - DP Revision: "+Config.DATAPACK_VERSION);
-			t.printStackTrace();
+			_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed running: " + getType() + " - L2J Server Version: " + Config.SERVER_VERSION + " - DP Revision: " + Config.DATAPACK_VERSION + " ; " + t.getMessage(), t);
 			// in case of EnterWorld error kick player from game
 			if (this instanceof EnterWorld) 
 				getClient().closeNow();

+ 5 - 11
L2_GameServer/java/com/l2jserver/gameserver/network/communityserver/CommunityServerThread.java

@@ -56,8 +56,7 @@ public final class CommunityServerThread extends NetConnection
 				}
 				catch (Exception e)
 				{
-					_log.log(Level.WARNING, "CommunityServerThread: Failed loading config file!", e);
-					e.printStackTrace();
+					_log.log(Level.WARNING, "CommunityServerThread: Failed loading config file! " + e.getMessage(), e);
 				}
 			}
 			else
@@ -100,8 +99,7 @@ public final class CommunityServerThread extends NetConnection
 		}
 		catch (IOException e)
 		{
-			_log.log(Level.INFO, "CommunityServerThread: Failed disconnecting server, server already disconnected.");
-			e.printStackTrace();
+			_log.log(Level.INFO, "CommunityServerThread: Failed disconnecting server, server already disconnected: " + e.getMessage(), e);
 		}
 	}
 	
@@ -121,8 +119,7 @@ public final class CommunityServerThread extends NetConnection
 		}
 		catch (IOException e)
 		{
-			_log.log(Level.INFO, "CommunityServerThread: Failed sending TCP packet.");
-			e.printStackTrace();
+			_log.log(Level.INFO, "CommunityServerThread: Failed sending TCP packet: " + e.getMessage(), e);
 			return false;
 		}
 		return true;
@@ -163,8 +160,7 @@ public final class CommunityServerThread extends NetConnection
 			}
 			catch (IOException e)
 			{
-				_log.log(Level.INFO, "CommunityServerThread: Connection failed!", e);
-				e.printStackTrace();
+				_log.log(Level.INFO, "CommunityServerThread: Connection failed: " + e.getMessage(), e);
 				continue;
 			}
 
@@ -255,9 +251,7 @@ public final class CommunityServerThread extends NetConnection
 			}
 			catch (IOException e)
 			{
-				e.printStackTrace();
-				
-				_log.log(Level.WARNING, "CommunityServerThread: TCP Connection lost!");
+				_log.log(Level.WARNING, "CommunityServerThread: TCP Connection lost: " + e.getMessage(), e);
 				
 				forceClose(null);
 			}

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/network/gameserverpackets/BlowFishKey.java

@@ -17,6 +17,7 @@ package com.l2jserver.gameserver.network.gameserverpackets;
 import java.io.IOException;
 import java.security.GeneralSecurityException;
 import java.security.interfaces.RSAPublicKey;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.crypto.Cipher;
@@ -46,8 +47,7 @@ public class BlowFishKey extends BaseSendablePacket
 		}
 		catch(GeneralSecurityException e)
 		{
-			_log.severe("Error While encrypting blowfish key for transmision (Crypt error)");
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "Error While encrypting blowfish key for transmision (Crypt error): " + e.getMessage(), e);
 		}
 		writeD(encrypted.length);
 		writeB(encrypted);

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/L2GameServerPacket.java

@@ -14,6 +14,7 @@
  */
 package com.l2jserver.gameserver.network.serverpackets;
 
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 
@@ -64,8 +65,7 @@ public abstract class L2GameServerPacket extends SendablePacket<L2GameClient>
 		}
 		catch (Exception e)
 		{
-			_log.severe("Client: "+getClient().toString()+" - Failed writing: "+getType()+" - L2J Server Version: "+Config.SERVER_VERSION+" - DP Revision: "+Config.DATAPACK_VERSION);
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed writing: " + getType() + " - L2J Server Version: " + Config.SERVER_VERSION + " - DP Revision: " + Config.DATAPACK_VERSION + " ; " + e.getMessage(), e);
 		}
 	}
 

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java

@@ -27,6 +27,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.Config;
@@ -438,8 +439,7 @@ public class GeoPathFinding extends PathFinding
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
-			_log.warning("Failed to Load PathNode File: " + fname + "\n");
+			_log.log(Level.WARNING, "Failed to Load PathNode File: " + fname + " : " + e.getMessage(), e);
 		}
 		finally
 		{

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/script/faenor/FaenorEventParser.java

@@ -13,6 +13,7 @@
 package com.l2jserver.gameserver.script.faenor;
 
 import java.util.Date;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.script.ScriptContext;
@@ -102,8 +103,7 @@ public class FaenorEventParser extends FaenorParser
 		}
 		catch (Exception e)
 		{
-			_log.warning("Error in event parser.");
-			e.printStackTrace();
+			_log.log(Level.WARNING, "Error in event parser: " + e.getMessage(), e);
 		}
 	}
 	

+ 3 - 4
L2_GameServer/java/com/l2jserver/gameserver/script/faenor/FaenorScriptEngine.java

@@ -19,6 +19,7 @@ import java.io.FileFilter;
 import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
@@ -186,8 +187,7 @@ public class FaenorScriptEngine extends ScriptEngine
 		}
 		catch (ParserNotCreatedException e)
 		{
-			_log.warning("ERROR: No parser registered for Script: " + parserClass);
-			e.printStackTrace();
+			_log.log(Level.WARNING, "ERROR: No parser registered for Script: " + parserClass + ": " + e.getMessage(), e);
 		}
 		
 		if (parser == null)
@@ -203,8 +203,7 @@ public class FaenorScriptEngine extends ScriptEngine
 		}
 		catch (Exception e)
 		{
-			e.printStackTrace();
-			_log.warning("Script Parsing Failed.");
+			_log.log(Level.WARNING, "Script Parsing Failed: " + e.getMessage(), e);
 		}
 	}
 	

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/script/faenor/FaenorWorldDataParser.java

@@ -15,6 +15,7 @@
 package com.l2jserver.gameserver.script.faenor;
 
 import java.util.Map;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.script.ScriptContext;
@@ -91,8 +92,7 @@ public class FaenorWorldDataParser extends FaenorParser
         catch (Exception e)
         {
             petData.petId = -1;
-            _log.warning("Error in pet Data parser.");
-            e.printStackTrace();
+            _log.log(Level.WARNING, "Error in pet Data parser: " + e.getMessage(), e);
         }
     }
 

+ 3 - 5
L2_GameServer/java/com/l2jserver/gameserver/scripting/L2ScriptEngineManager.java

@@ -149,8 +149,7 @@ public final class L2ScriptEngineManager
 			}
 			catch (Exception e)
 			{
-				_log.warning("Failed initializing factory. ");
-				e.printStackTrace();
+				_log.log(Level.WARNING, "Failed initializing factory: " + e.getMessage(), e);
 			}
 		}
 		
@@ -580,9 +579,8 @@ public final class L2ScriptEngineManager
 			}
 			catch (IOException ioe)
 			{
-				_log.warning("Failed executing script: " + script.getAbsolutePath() + "\r\n" + e.getMessage()
-						+ "Additionally failed when trying to write an error report on script directory. Reason: " + ioe.getMessage());
-				ioe.printStackTrace();
+				_log.log(Level.WARNING, "Failed executing script: " + script.getAbsolutePath() + "\r\n" + e.getMessage()
+						+ "Additionally failed when trying to write an error report on script directory. Reason: " + ioe.getMessage(), ioe);
 			}
 			finally
 			{

+ 2 - 3
L2_GameServer/java/com/l2jserver/gameserver/taskmanager/KnownListUpdateTaskManager.java

@@ -15,6 +15,7 @@
 package com.l2jserver.gameserver.taskmanager;
 
 import java.util.Collection;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javolution.util.FastSet;
@@ -80,9 +81,7 @@ public class KnownListUpdateTaskManager
 						}
 						catch (Exception e)
 						{
-							_log.info("KnownListUpdateTaskManager: updateRegion(" + _fullUpdateTimer + "," + updatePass + ") failed for region " + r.getName() + ". Full update scheduled. " + e);
-							if (Config.DEBUG)
-								e.printStackTrace();
+							_log.log(Level.WARNING, "KnownListUpdateTaskManager: updateRegion(" + _fullUpdateTimer + "," + updatePass + ") failed for region " + r.getName() + ". Full update scheduled. " + e.getMessage(), e);
 							_failedRegions.add(r);
 						}
 					}

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/taskmanager/TaskManager.java

@@ -26,6 +26,7 @@ import java.text.DateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.concurrent.ScheduledFuture;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.L2DatabaseFactory;
@@ -225,8 +226,7 @@ public final class TaskManager
 		}
 		catch (Exception e)
 		{
-			_log.severe("error while loading Global Task table " + e);
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "Error while loading Global Task table: " + e.getMessage(), e);
 		}
 		finally
 		{

+ 4 - 48
L2_GameServer/java/com/l2jserver/loginserver/L2LoginServer.java

@@ -112,10 +112,6 @@ public class L2LoginServer
 		catch (SQLException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed initializing database. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		
@@ -126,10 +122,6 @@ public class L2LoginServer
 		catch (GeneralSecurityException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		
@@ -140,19 +132,11 @@ public class L2LoginServer
 		catch (GeneralSecurityException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed to load GameServerTable. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		catch (SQLException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed to load GameServerTable. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		
@@ -167,11 +151,7 @@ public class L2LoginServer
 			}
 			catch (UnknownHostException e)
 			{
-				_log.warning("WARNING: The LoginServer bind address is invalid, using all avaliable IPs. Reason: " + e.getMessage());
-				if (Config.DEVELOPER)
-				{
-					e.printStackTrace();
-				}
+				_log.log(Level.WARNING, "WARNING: The LoginServer bind address is invalid, using all avaliable IPs. Reason: " + e.getMessage(), e);
 			}
 		}
 		
@@ -190,10 +170,6 @@ public class L2LoginServer
 		catch (IOException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed to open Selector. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		
@@ -206,10 +182,6 @@ public class L2LoginServer
 		catch (IOException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		
@@ -222,11 +194,7 @@ public class L2LoginServer
 			}
 			catch (IOException e)
 			{
-				_log.warning("Failed to start the Telnet Server. Reason: " + e.getMessage());
-				if (Config.DEVELOPER)
-				{
-					e.printStackTrace();
-				}
+				_log.log(Level.WARNING, "Failed to start the Telnet Server. Reason: " + e.getMessage(), e);
 			}
 		}
 		else
@@ -241,10 +209,6 @@ public class L2LoginServer
 		catch (IOException e)
 		{
 			_log.log(Level.SEVERE, "FATAL: Failed to open server socket. Reason: " + e.getMessage(), e);
-			if (Config.DEVELOPER)
-			{
-				e.printStackTrace();
-			}
 			System.exit(1);
 		}
 		_selectorThread.start();
@@ -273,11 +237,7 @@ public class L2LoginServer
 			}
 			catch (FileNotFoundException e)
 			{
-				_log.warning("Failed to load banned IPs file (" + bannedFile.getName() + ") for reading. Reason: " + e.getMessage());
-				if (Config.DEVELOPER)
-				{
-					e.printStackTrace();
-				}
+				_log.log(Level.WARNING, "Failed to load banned IPs file (" + bannedFile.getName() + ") for reading. Reason: " + e.getMessage(), e);
 				return;
 			}
 			
@@ -332,11 +292,7 @@ public class L2LoginServer
 			}
 			catch (IOException e)
 			{
-				_log.warning("Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage());
-				if (Config.DEVELOPER)
-				{
-					e.printStackTrace();
-				}
+				_log.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
 			}
 			finally
 			{

+ 2 - 2
L2_GameServer/java/com/l2jserver/loginserver/clientpackets/L2LoginClientPacket.java

@@ -14,6 +14,7 @@
  */
 package com.l2jserver.loginserver.clientpackets;
 
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 
@@ -41,8 +42,7 @@ public abstract class L2LoginClientPacket extends ReceivablePacket<L2LoginClient
 		}
 		catch (Exception e)
 		{
-			_log.severe("ERROR READING: "+this.getClass().getSimpleName());
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "ERROR READING: "+this.getClass().getSimpleName() + ": " + e.getMessage(), e);
 			return false;
 		}
 	}

+ 2 - 2
L2_GameServer/java/com/l2jserver/loginserver/gameserverpackets/BlowFishKey.java

@@ -16,6 +16,7 @@ package com.l2jserver.loginserver.gameserverpackets;
 
 import java.security.GeneralSecurityException;
 import java.security.interfaces.RSAPrivateKey;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.crypto.Cipher;
@@ -58,8 +59,7 @@ public class BlowFishKey extends BaseRecievePacket
 		}
 		catch(GeneralSecurityException e)
 		{
-			_log.severe("Error While decrypting blowfish key (RSA)");
-			e.printStackTrace();
+			_log.log(Level.SEVERE, "Error While decrypting blowfish key (RSA): " + e.getMessage(), e);
 		}
 		/*catch(IOException ioe)
 		{

部分文件因为文件数量过多而无法显示