Kaynağa Gözat

Gameserver classes upgraded loggers

Zoey76 9 yıl önce
ebeveyn
işleme
a3d7adc378

+ 10 - 8
L2J_Server/java/com/l2jserver/gameserver/GeoData.java

@@ -20,8 +20,9 @@ package com.l2jserver.gameserver;
 
 import java.nio.file.Files;
 import java.nio.file.Path;
-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.gameserver.data.xml.impl.DoorData;
@@ -36,11 +37,12 @@ import com.l2jserver.geodriver.Cell;
 import com.l2jserver.geodriver.GeoDriver;
 
 /**
+ * Geodata.
  * @author -Nemesiss-, HorridoJoho
  */
 public class GeoData
 {
-	private static final Logger LOGGER = Logger.getLogger(GeoData.class.getName());
+	private static final Logger LOGGER = LoggerFactory.getLogger(GeoData.class);
 	private static final String FILE_NAME_FORMAT = "%d_%d.l2j";
 	private static final int ELEVATED_SEE_OVER_DISTANCE = 2;
 	private static final int MAX_SEE_OVER_HEIGHT = 48;
@@ -63,7 +65,7 @@ public class GeoData
 					{
 						if (loadFile)
 						{
-							LOGGER.info(getClass().getSimpleName() + ": Loading " + geoFilePath.getFileName() + "...");
+							LOGGER.info("{}: Loading {}...", getClass().getSimpleName(), geoFilePath.getFileName());
 							_driver.loadRegion(geoFilePath, regionX, regionY);
 							loadedRegions++;
 						}
@@ -72,13 +74,13 @@ public class GeoData
 					{
 						try
 						{
-							LOGGER.info(getClass().getSimpleName() + ": Loading " + geoFilePath.getFileName() + "...");
+							LOGGER.info("{}: Loading {}...", getClass().getSimpleName(), geoFilePath.getFileName());
 							_driver.loadRegion(geoFilePath, regionX, regionY);
 							loadedRegions++;
 						}
 						catch (Exception e)
 						{
-							LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed to load " + geoFilePath.getFileName() + "!", e);
+							LOGGER.warn("{}: Failed to load {}!", getClass().getSimpleName(), geoFilePath.getFileName(), e);
 						}
 					}
 				}
@@ -86,11 +88,11 @@ public class GeoData
 		}
 		catch (Exception e)
 		{
-			LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Failed to load geodata!", e);
+			LOGGER.error("{}: Failed to load geodata!", e);
 			System.exit(1);
 		}
 		
-		LOGGER.info(getClass().getSimpleName() + ": Loaded " + loadedRegions + " regions.");
+		LOGGER.info("{}: Loaded {} regions.", loadedRegions);
 	}
 	
 	public boolean hasGeoPos(int geoX, int geoY)

+ 30 - 35
L2J_Server/java/com/l2jserver/gameserver/LoginServerThread.java

@@ -40,9 +40,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.l2jserver.Config;
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
@@ -80,8 +80,8 @@ import com.l2jserver.util.network.BaseSendablePacket;
 
 public class LoginServerThread extends Thread
 {
-	protected static final Logger _log = Logger.getLogger(LoginServerThread.class.getName());
-	protected static final Logger _logAccounting = Logger.getLogger("accounting");
+	protected static final Logger _log = LoggerFactory.getLogger(LoginServerThread.class);
+	protected static final Logger _logAccounting = LoggerFactory.getLogger("accounting");
 	
 	/** @see com.l2jserver.loginserver.L2LoginServer#PROTOCOL_REV */
 	private static final int REVISION = 0x0106;
@@ -140,15 +140,6 @@ public class LoginServerThread extends Thread
 		_maxPlayer = Config.MAXIMUM_ONLINE_USERS;
 	}
 	
-	/**
-	 * Gets the single instance of LoginServerThread.
-	 * @return single instance of LoginServerThread
-	 */
-	public static LoginServerThread getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
 	@Override
 	public void run()
 	{
@@ -161,7 +152,7 @@ public class LoginServerThread extends Thread
 			try
 			{
 				// Connection
-				_log.info("Connecting to login on " + _hostname + ":" + _port);
+				_log.info("Connecting to login on {}:{}", _hostname, _port);
 				_loginSocket = new Socket(_hostname, _port);
 				InputStream in = _loginSocket.getInputStream();
 				_out = new BufferedOutputStream(_loginSocket.getOutputStream());
@@ -182,7 +173,7 @@ public class LoginServerThread extends Thread
 					
 					if (lengthHi < 0)
 					{
-						_log.finer("LoginServerThread: Login terminated the connection.");
+						_log.info("LoginServerThread: Login terminated the connection.");
 						break;
 					}
 					
@@ -200,7 +191,7 @@ public class LoginServerThread extends Thread
 					
 					if (receivedBytes != (length - 2))
 					{
-						_log.warning("Incomplete Packet is sent to the server, closing connection.(LS)");
+						_log.warn("Incomplete Packet is sent to the server, closing connection.(LS)");
 						break;
 					}
 					
@@ -210,7 +201,7 @@ public class LoginServerThread extends Thread
 					
 					if (!checksumOk)
 					{
-						_log.warning("Incorrect packet checksum, ignoring packet (LS)");
+						_log.warn("Incorrect packet checksum, ignoring packet (LS)");
 						break;
 					}
 					
@@ -222,7 +213,7 @@ public class LoginServerThread extends Thread
 							if (init.getRevision() != REVISION)
 							{
 								// TODO: revision mismatch
-								_log.warning("/!\\ Revision mismatch between LS and GS /!\\");
+								_log.warn("/!\\ Revision mismatch between LS and GS /!\\");
 								break;
 							}
 							
@@ -237,7 +228,7 @@ public class LoginServerThread extends Thread
 							}
 							catch (GeneralSecurityException e)
 							{
-								_log.warning("Trouble while init the public key send by login");
+								_log.warn("Trouble while init the public key send by login");
 								break;
 							}
 							// send the blowfish key through the rsa encryption
@@ -248,7 +239,7 @@ public class LoginServerThread extends Thread
 							break;
 						case 0x01:
 							LoginServerFail lsf = new LoginServerFail(incoming);
-							_log.info("Damn! Registeration Failed: " + lsf.getReasonString());
+							_log.info("Damn! Registeration Failed: {}", lsf.getReasonString());
 							// login will close the connection here
 							break;
 						case 0x02:
@@ -256,7 +247,7 @@ public class LoginServerThread extends Thread
 							int serverID = aresp.getServerId();
 							_serverName = aresp.getServerName();
 							Config.saveHexid(serverID, hexToString(_hexID));
-							_log.info("Registered on login as Server " + serverID + " : " + _serverName);
+							_log.info("Registered on login as Server {}: {}", serverID, _serverName);
 							ServerStatus st = new ServerStatus();
 							if (Config.SERVER_LIST_BRACKET)
 							{
@@ -326,7 +317,7 @@ public class LoginServerThread extends Thread
 								}
 								else
 								{
-									_log.warning("Session key is not correct. Closing connection for account " + wcToRemove.account + ".");
+									_log.warn("Session key is not correct. Closing connection for account {}.", wcToRemove.account);
 									// wcToRemove.gameClient.getConnection().sendPacket(new LoginFail(LoginFail.SYSTEM_ERROR_LOGIN_LATER));
 									wcToRemove.gameClient.close(new LoginFail(LoginFail.SYSTEM_ERROR_LOGIN_LATER));
 									_accountsInGameServer.remove(wcToRemove.account);
@@ -350,15 +341,15 @@ public class LoginServerThread extends Thread
 			}
 			catch (UnknownHostException e)
 			{
-				_log.log(Level.WARNING, "", e);
+				_log.warn("Unknown host!", e);
 			}
 			catch (SocketException e)
 			{
-				_log.warning("LoginServer not avaible, trying to reconnect...");
+				_log.warn("LoginServer not avaible, trying to reconnect...");
 			}
 			catch (IOException e)
 			{
-				_log.log(Level.WARNING, "Disconnected from Login, Trying to reconnect: " + e.getMessage(), e);
+				_log.warn("Disconnected from Login, Trying to reconnect!", e);
 			}
 			finally
 			{
@@ -406,7 +397,7 @@ public class LoginServerThread extends Thread
 		}
 		catch (IOException e)
 		{
-			_log.warning("Error while sending player auth request");
+			_log.warn("Error while sending player auth request!");
 		}
 	}
 	
@@ -450,7 +441,7 @@ public class LoginServerThread extends Thread
 		}
 		catch (IOException e)
 		{
-			_log.warning("Error while sending logout packet to login");
+			_log.warn("Error while sending logout packet to login!");
 		}
 		finally
 		{
@@ -558,12 +549,7 @@ public class LoginServerThread extends Thread
 		L2GameClient client = _accountsInGameServer.get(account);
 		if (client != null)
 		{
-			LogRecord record = new LogRecord(Level.WARNING, "Kicked by login");
-			record.setParameters(new Object[]
-			{
-				client
-			});
-			_logAccounting.log(record);
+			_logAccounting.warn("Kicked by login: {}", client);
 			client.setAditionalClosePacket(SystemMessage.getSystemMessage(SystemMessageId.ANOTHER_LOGIN_WITH_ACCOUNT));
 			client.closeNow();
 		}
@@ -597,7 +583,7 @@ public class LoginServerThread extends Thread
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.WARNING, "Exception: getCharsOnServer: " + e.getMessage(), e);
+			_log.warn("Exception: getCharsOnServer!", e);
 		}
 		
 		ReplyCharacters rec = new ReplyCharacters(account, chars, charToDel);
@@ -812,6 +798,15 @@ public class LoginServerThread extends Thread
 		}
 	}
 	
+	/**
+	 * Gets the single instance of LoginServerThread.
+	 * @return single instance of LoginServerThread
+	 */
+	public static LoginServerThread getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	{
 		protected static final LoginServerThread _instance = new LoginServerThread();

+ 5 - 5
L2J_Server/java/com/l2jserver/gameserver/MonsterRace.java

@@ -19,8 +19,9 @@
 package com.l2jserver.gameserver;
 
 import java.lang.reflect.Constructor;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.l2jserver.gameserver.data.xml.impl.NpcData;
 import com.l2jserver.gameserver.model.actor.L2Npc;
@@ -29,7 +30,7 @@ import com.l2jserver.util.Rnd;
 
 public class MonsterRace
 {
-	protected static final Logger _log = Logger.getLogger(MonsterRace.class.getName());
+	protected static final Logger _log = LoggerFactory.getLogger(MonsterRace.class);
 	
 	private final L2Npc[] _monsters;
 	private int[][] _speeds;
@@ -76,9 +77,8 @@ public class MonsterRace
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "", e);
+				_log.warn("Unable to create monster!", e);
 			}
-			// _log.info("Monster "+i+" is id: "+(id+random));
 		}
 		newSpeeds();
 	}

+ 21 - 19
L2J_Server/java/com/l2jserver/gameserver/SevenSigns.java

@@ -28,8 +28,9 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-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.commons.database.pool.impl.ConnectionFactory;
@@ -53,7 +54,7 @@ import com.l2jserver.gameserver.util.Broadcast;
  */
 public class SevenSigns
 {
-	protected static final Logger _log = Logger.getLogger(SevenSigns.class.getName());
+	protected static final Logger _log = LoggerFactory.getLogger(SevenSigns.class);
 	
 	// Basic Seven Signs Constants \\
 	public static final String SEVEN_SIGNS_HTML_PATH = "data/html/seven_signs/";
@@ -149,10 +150,11 @@ public class SevenSigns
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.SEVERE, "SevenSigns: Failed to load configuration: " + e.getMessage(), e);
+			_log.error("SevenSigns: Failed to load configuration!", e);
 		}
 		
-		_log.info("SevenSigns: Currently in the " + getCurrentPeriodName() + " period!");
+		_log.info("SevenSigns: Currently in the {} period.", getCurrentPeriodName());
+		
 		initializeSeals();
 		
 		if (isSealValidationPeriod())
@@ -163,7 +165,7 @@ public class SevenSigns
 			}
 			else
 			{
-				_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " were victorious last week.");
+				_log.info("SevenSigns: The {} were victorious last week.", getCabalName(getCabalHighestScore()));
 			}
 		}
 		else if (getCabalHighestScore() == CABAL_NULL)
@@ -172,7 +174,7 @@ public class SevenSigns
 		}
 		else
 		{
-			_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " are in the lead this week.");
+			_log.info("SevenSigns: The {} are in the lead this week.", getCabalName(getCabalHighestScore()));
 		}
 		
 		long milliToChange = 0;
@@ -198,7 +200,7 @@ public class SevenSigns
 		int numHours = (int) Math.floor(countDown % 24);
 		int numDays = (int) Math.floor((countDown - numHours) / 24);
 		
-		_log.info("SevenSigns: Next period begins in " + numDays + " days, " + numHours + " hours and " + numMins + " mins.");
+		_log.info("SevenSigns: Next period begins in {} days, {} hours and {} mins.", numDays, numHours, numMins);
 		
 	}
 	
@@ -534,7 +536,7 @@ public class SevenSigns
 				_nextPeriodChange.add(Calendar.MILLISECOND, PERIOD_MINOR_LENGTH);
 				break;
 		}
-		_log.info("SevenSigns: Next period change set to " + _nextPeriodChange.getTime());
+		_log.info("SevenSigns: Next period change set to {}.", _nextPeriodChange.getTime());
 	}
 	
 	public final String getCurrentPeriodName()
@@ -857,7 +859,7 @@ public class SevenSigns
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSigns: Unable to load Seven Signs data from database: " + e.getMessage(), e);
+			_log.error("SevenSigns: Unable to load Seven Signs data from database!", e);
 		}
 		// Festival data is loaded now after the Seven Signs engine data.
 	}
@@ -887,7 +889,7 @@ public class SevenSigns
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
+			_log.error("SevenSigns: Unable to save data to database!", e);
 		}
 	}
 	
@@ -914,7 +916,7 @@ public class SevenSigns
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
+			_log.error("SevenSigns: Unable to save data to database!", e);
 		}
 	}
 	
@@ -951,7 +953,7 @@ public class SevenSigns
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
+			_log.error("SevenSigns: Unable to save data to database!", e);
 		}
 	}
 	
@@ -1017,7 +1019,7 @@ public class SevenSigns
 			}
 			catch (SQLException e)
 			{
-				_log.log(Level.SEVERE, "SevenSigns: Failed to save data: " + e.getMessage(), e);
+				_log.error("SevenSigns: Failed to save data!", e);
 			}
 		}
 		
@@ -1196,16 +1198,16 @@ public class SevenSigns
 			{
 				if (isSealValidationPeriod())
 				{
-					_log.info("SevenSigns: The " + getCabalName(e.getValue()) + " have won the " + getSealName(e.getKey(), false) + ".");
+					_log.info("SevenSigns: The {} have won the {}.", getCabalName(e.getValue()), getSealName(e.getKey(), false));
 				}
 				else
 				{
-					_log.info("SevenSigns: The " + getSealName(e.getKey(), false) + " is currently owned by " + getCabalName(e.getValue()) + ".");
+					_log.info("SevenSigns: The {} is currently owned by {}.", getSealName(e.getKey(), false), getCabalName(e.getValue()));
 				}
 			}
 			else
 			{
-				_log.info("SevenSigns: The " + getSealName(e.getKey(), false) + " remains unclaimed.");
+				_log.info("SevenSigns: The {} remains unclaimed.", getSealName(e.getKey(), false));
 			}
 		}
 	}
@@ -1496,7 +1498,7 @@ public class SevenSigns
 					// Send message that Seal Validation has begun.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_BEGUN);
 					
-					_log.info("SevenSigns: The " + getCabalName(_previousWinner) + " have won the competition with " + getCurrentScore(_previousWinner) + " points!");
+					_log.info("SevenSigns: The {} have won the competition with {} points!", getCabalName(_previousWinner), getCurrentScore(_previousWinner));
 					break;
 				case PERIOD_SEAL_VALIDATION: // Reset for New Cycle
 					
@@ -1535,7 +1537,7 @@ public class SevenSigns
 			Broadcast.toAllOnlinePlayers(ss);
 			spawnSevenSignsNPC();
 			
-			_log.info("SevenSigns: The " + getCurrentPeriodName() + " period has begun!");
+			_log.info("SevenSigns: The {} period has begun!", getCurrentPeriodName());
 			
 			setCalendarForNextPeriodChange();
 			

+ 14 - 12
L2J_Server/java/com/l2jserver/gameserver/SevenSignsFestival.java

@@ -29,8 +29,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ScheduledFuture;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.l2jserver.Config;
 import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
@@ -72,7 +74,7 @@ import com.l2jserver.util.Rnd;
  */
 public class SevenSignsFestival implements SpawnListener
 {
-	protected static final Logger _log = Logger.getLogger(SevenSignsFestival.class.getName());
+	protected static final Logger _log = LoggerFactory.getLogger(SevenSignsFestival.class);
 	
 	private static final String GET_CLAN_NAME = "SELECT clan_name FROM clan_data WHERE clan_id = (SELECT clanid FROM characters WHERE char_name = ?)";
 	
@@ -916,7 +918,7 @@ public class SevenSignsFestival implements SpawnListener
 		setNextFestivalStart(Config.ALT_FESTIVAL_MANAGER_START + FESTIVAL_SIGNUP_TIME);
 		_managerScheduledTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(_managerInstance, Config.ALT_FESTIVAL_MANAGER_START, Config.ALT_FESTIVAL_CYCLE_LENGTH);
 		
-		_log.info("SevenSignsFestival: The first Festival of Darkness cycle begins in " + (Config.ALT_FESTIVAL_MANAGER_START / 60000) + " minute(s).");
+		_log.info("SevenSignsFestival: The first Festival of Darkness cycle begins in {} minute(s).", TimeUnit.MILLISECONDS.toMinutes(Config.ALT_FESTIVAL_MANAGER_START));
 	}
 	
 	/**
@@ -954,7 +956,7 @@ public class SevenSignsFestival implements SpawnListener
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSignsFestival: Failed to load configuration: " + e.getMessage(), e);
+			_log.error("SevenSignsFestival: Failed to load configuration!", e);
 		}
 		
 		StringBuilder query = new StringBuilder();
@@ -988,7 +990,7 @@ public class SevenSignsFestival implements SpawnListener
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSignsFestival: Failed to load configuration: " + e.getMessage(), e);
+			_log.error("SevenSignsFestival: Failed to load configuration!", e);
 		}
 	}
 	
@@ -1038,7 +1040,7 @@ public class SevenSignsFestival implements SpawnListener
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.SEVERE, "SevenSignsFestival: Failed to save configuration: " + e.getMessage(), e);
+			_log.error("SevenSignsFestival: Failed to save configuration!", e);
 		}
 		
 		// Updates Seven Signs DB data also, so call only if really necessary.
@@ -1147,7 +1149,7 @@ public class SevenSignsFestival implements SpawnListener
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "Could not get clan name of " + partyMemberName + ": " + e.getMessage(), e);
+				_log.warn("Could not get clan name of {}!", partyMemberName, e);
 			}
 		}
 	}
@@ -2001,7 +2003,7 @@ public class SevenSignsFestival implements SpawnListener
 			}
 			catch (Exception e)
 			{
-				_log.warning(e.getMessage());
+				_log.warn("Could not run featival task!", e);
 			}
 		}
 		
@@ -2150,10 +2152,10 @@ public class SevenSignsFestival implements SpawnListener
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "SevenSignsFestival: Error while spawning Festival Witch ID " + _witchSpawn._npcId + ": " + e.getMessage(), e);
+				_log.warn("SevenSignsFestival: Error while spawning Festival Witch ID {}!", _witchSpawn._npcId, e);
 			}
 			
-			// Make it appear as though the Witch has apparated there.
+			// Make it appear as though the Witch has appeared there.
 			MagicSkillUse msu = new MagicSkillUse(_witchInst, _witchInst, 2003, 1, 1, 0);
 			_witchInst.broadcastPacket(msu);
 			
@@ -2285,7 +2287,7 @@ public class SevenSignsFestival implements SpawnListener
 				}
 				catch (Exception e)
 				{
-					_log.log(Level.WARNING, "SevenSignsFestival: Error while spawning NPC ID " + currSpawn._npcId + ": " + e.getMessage(), e);
+					_log.warn("SevenSignsFestival: Error while spawning NPC ID {}!", currSpawn._npcId, e);
 				}
 			}
 		}

+ 47 - 48
L2J_Server/java/com/l2jserver/gameserver/Shutdown.java

@@ -18,8 +18,10 @@
  */
 package com.l2jserver.gameserver;
 
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.l2jserver.Config;
 import com.l2jserver.UPnPService;
@@ -54,7 +56,7 @@ import com.l2jserver.gameserver.util.Broadcast;
  */
 public class Shutdown extends Thread
 {
-	private static final Logger _log = Logger.getLogger(Shutdown.class.getName());
+	private static final Logger _log = LoggerFactory.getLogger(Shutdown.class);
 	private static Shutdown _counterInstance = null;
 	
 	private int _secondsShut;
@@ -84,7 +86,7 @@ public class Shutdown extends Thread
 	
 	public void startTelnetShutdown(String IP, int seconds, boolean restart)
 	{
-		_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
+		_log.warn("IP: {} issued shutdown command. {} in {} seconds!", IP, MODE_TEXT[_shutdownMode], seconds);
 		
 		if (restart)
 		{
@@ -135,7 +137,7 @@ public class Shutdown extends Thread
 	 */
 	public void telnetAbort(String IP)
 	{
-		_log.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
+		_log.warn("IP: {} issued shutdown ABORT. {} has been stopped!", IP, MODE_TEXT[_shutdownMode]);
 		
 		if (_counterInstance != null)
 		{
@@ -191,11 +193,11 @@ public class Shutdown extends Thread
 			try
 			{
 				UPnPService.getInstance().removeAllPorts();
-				_log.info("UPnP Service: All ports mappings deleted (" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("UPnP Service: All ports mappings deleted ({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "Error while removing UPnP port mappings: ", t);
+				_log.warn("Error while removing UPnP port mappings!", e);
 			}
 			
 			try
@@ -203,20 +205,20 @@ public class Shutdown extends Thread
 				if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
 				{
 					OfflineTradersTable.getInstance().storeOffliners();
-					_log.info("Offline Traders Table: Offline shops stored(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+					_log.info("Offline Traders Table: Offline shops stored({}ms).", tc.getEstimatedTimeAndRestartCounter());
 				}
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "Error saving offline shops.", t);
+				_log.warn("Error saving offline shops!", e);
 			}
 			
 			try
 			{
 				disconnectAllCharacters();
-				_log.info("All players disconnected and saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("All players disconnected and saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
 				// ignore
 			}
@@ -225,20 +227,20 @@ public class Shutdown extends Thread
 			try
 			{
 				GameTimeController.getInstance().stopTimer();
-				_log.info("Game Time Controller: Timer stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("Game Time Controller: Timer stopped({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
 				// ignore
 			}
 			
-			// stop all threadpolls
+			// stop all thread pools
 			try
 			{
 				ThreadPoolManager.getInstance().shutdown();
-				_log.info("Thread Pool Manager: Manager has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("Thread Pool Manager: Manager has been shut down({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
 				// ignore
 			}
@@ -246,9 +248,9 @@ public class Shutdown extends Thread
 			try
 			{
 				LoginServerThread.getInstance().interrupt();
-				_log.info("Login Server Thread: Thread interruped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("Login Server Thread: Thread interruped({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
 				// ignore
 			}
@@ -261,9 +263,9 @@ public class Shutdown extends Thread
 			try
 			{
 				GameServer.gameServer.getSelectorThread().shutdown();
-				_log.info("Game Server: Selector thread has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("Game Server: Selector thread has been shut down({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
 				// ignore
 			}
@@ -272,9 +274,9 @@ public class Shutdown extends Thread
 			try
 			{
 				ConnectionFactory.getInstance().close();
-				_log.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+				_log.info("ConnectionFactory: Database connection has been shut down({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
 				
 			}
@@ -289,14 +291,14 @@ public class Shutdown extends Thread
 				Runtime.getRuntime().halt(0);
 			}
 			
-			_log.info("The server has been successfully shut down in " + (tc1.getEstimatedTime() / 1000) + "seconds.");
+			_log.info("The server has been successfully shut down in {}seconds.", TimeUnit.MILLISECONDS.toSeconds(tc1.getEstimatedTime()));
 		}
 		else
 		{
 			// gm shutdown: send warnings and then call exit to start shutdown sequence
 			countdown();
 			// last point where logging is operational :(
-			_log.warning("GM shutdown countdown is over. " + MODE_TEXT[_shutdownMode] + " NOW!");
+			_log.warn("GM shutdown countdown is over. {} NOW!", MODE_TEXT[_shutdownMode]);
 			switch (_shutdownMode)
 			{
 				case GM_SHUTDOWN:
@@ -331,7 +333,7 @@ public class Shutdown extends Thread
 			_shutdownMode = GM_SHUTDOWN;
 		}
 		
-		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
+		_log.warn("GM: {}({}) issued shutdown command. {} in {} seconds!", activeChar.getName(), activeChar.getObjectId(), MODE_TEXT[_shutdownMode], seconds);
 		
 		if (_shutdownMode > 0)
 		{
@@ -375,7 +377,7 @@ public class Shutdown extends Thread
 	 */
 	public void abort(L2PcInstance activeChar)
 	{
-		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
+		_log.warn("GM: {}({}) issued shutdown ABORT. {} has been stopped!", activeChar.getName(), activeChar.getObjectId(), MODE_TEXT[_shutdownMode]);
 		if (_counterInstance != null)
 		{
 			_counterInstance._abort();
@@ -500,46 +502,43 @@ public class Shutdown extends Thread
 		
 		}
 		
-		/*
-		 * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true);
-		 */
 		TimeCounter tc = new TimeCounter();
 		// Seven Signs data is now saved along with Festival data.
 		if (!SevenSigns.getInstance().isSealValidationPeriod())
 		{
 			SevenSignsFestival.getInstance().saveFestivalData(false);
-			_log.info("SevenSignsFestival: Festival data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+			_log.info("SevenSignsFestival: Festival data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		}
 		
 		// Save Seven Signs data before closing. :)
 		SevenSigns.getInstance().saveSevenSignsData();
-		_log.info("SevenSigns: Seven Signs data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("SevenSigns: Seven Signs data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		SevenSigns.getInstance().saveSevenSignsStatus();
-		_log.info("SevenSigns: Seven Signs status saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("SevenSigns: Seven Signs status saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		
 		// Save all raidboss and GrandBoss status ^_^
 		RaidBossSpawnManager.getInstance().cleanUp();
-		_log.info("RaidBossSpawnManager: All raidboss info saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("RaidBossSpawnManager: All raidboss info saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		GrandBossManager.getInstance().cleanUp();
-		_log.info("GrandBossManager: All Grand Boss info saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("GrandBossManager: All Grand Boss info saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		ItemAuctionManager.getInstance().shutdown();
-		_log.info("Item Auction Manager: All tasks stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Item Auction Manager: All tasks stopped({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		Olympiad.getInstance().saveOlympiadStatus();
-		_log.info("Olympiad System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Olympiad System: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		Hero.getInstance().shutdown();
-		_log.info("Hero System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Hero System: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		ClanTable.getInstance().storeClanScore();
-		_log.info("Clan System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Clan System: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		
 		// Save Cursed Weapons data before closing.
 		CursedWeaponsManager.getInstance().saveData();
-		_log.info("Cursed Weapons Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Cursed Weapons Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		
 		// Save all manor data
 		if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
 		{
 			CastleManorManager.getInstance().storeMe();
-			_log.info("Castle Manor Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+			_log.info("Castle Manor Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		}
 		
 		CHSiegeManager.getInstance().onServerShutDown();
@@ -547,19 +546,19 @@ public class Shutdown extends Thread
 		
 		// Save all global (non-player specific) Quest data that needs to persist after reboot
 		QuestManager.getInstance().save();
-		_log.info("Quest Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Quest Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		
 		// Save all global variables data
 		GlobalVariablesManager.getInstance().storeMe();
-		_log.info("Global Variables Manager: Variables saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+		_log.info("Global Variables Manager: Variables saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		
 		// Save items on ground before closing
 		if (Config.SAVE_DROPPED_ITEM)
 		{
 			ItemsOnGroundManager.getInstance().saveInDb();
-			_log.info("Items On Ground Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+			_log.info("Items On Ground Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
 			ItemsOnGroundManager.getInstance().cleanUp();
-			_log.info("Items On Ground Manager: Cleaned up(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
+			_log.info("Items On Ground Manager: Cleaned up({}ms).", tc.getEstimatedTimeAndRestartCounter());
 		}
 		
 		// Save bot reports to database
@@ -598,9 +597,9 @@ public class Shutdown extends Thread
 				}
 				player.deleteMe();
 			}
-			catch (Throwable t)
+			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "Failed logour char " + player, t);
+				_log.warn("Failed logour char {}", player, e);
 			}
 		}
 	}

+ 8 - 7
L2J_Server/java/com/l2jserver/gameserver/ThreadPoolManager.java

@@ -27,8 +27,9 @@ import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-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.util.StringUtil;
@@ -51,9 +52,9 @@ import com.l2jserver.util.StringUtil;
  * </ul>
  * or
  * <ul>
- * <li>{@link #scheduleEffectAtFixedRate(Runnable, long, long, TimeUnit)} and {@link #scheduleEffectAtFixedRate(Runnable, long, long)} : for effects Tasks that needs to be executed periodicaly.</li>
- * <li>{@link #scheduleGeneralAtFixedRate(Runnable, long, long, TimeUnit)} and {@link #scheduleGeneralAtFixedRate(Runnable, long, long)} : for scheduled Tasks that needs to be executed periodicaly.</li>
- * <li>{@link #scheduleAiAtFixedRate(Runnable, long, long, TimeUnit)} and {@link #scheduleAiAtFixedRate(Runnable, long, long)} : for AI Tasks that needs to be executed periodicaly</li>
+ * <li>{@link #scheduleEffectAtFixedRate(Runnable, long, long, TimeUnit)} and {@link #scheduleEffectAtFixedRate(Runnable, long, long)} : for effects Tasks that needs to be executed periodically.</li>
+ * <li>{@link #scheduleGeneralAtFixedRate(Runnable, long, long, TimeUnit)} and {@link #scheduleGeneralAtFixedRate(Runnable, long, long)} : for scheduled Tasks that needs to be executed periodically.</li>
+ * <li>{@link #scheduleAiAtFixedRate(Runnable, long, long, TimeUnit)} and {@link #scheduleAiAtFixedRate(Runnable, long, long)} : for AI Tasks that needs to be executed periodically</li>
  * </ul>
  * </p>
  * <p>
@@ -69,7 +70,7 @@ import com.l2jserver.util.StringUtil;
  */
 public class ThreadPoolManager
 {
-	protected static final Logger _log = Logger.getLogger(ThreadPoolManager.class.getName());
+	protected static final Logger _log = LoggerFactory.getLogger(ThreadPoolManager.class);
 	
 	private static final class RunnableWrapper implements Runnable
 	{
@@ -571,7 +572,7 @@ public class ThreadPoolManager
 		}
 		catch (InterruptedException e)
 		{
-			_log.log(Level.WARNING, "", e);
+			_log.warn("There has been a problem shuting down the thread pool manager!", e);
 		}
 	}