Browse Source

Performance tweak: Disable game logs from config by default. Thanks pompinis.

DrHouse 16 years ago
parent
commit
0b51263627

+ 2 - 1
L2_GameServer/java/config/General.properties

@@ -89,10 +89,11 @@ GameGuardProhibitAction = True
 #		This will increase writing to your hard drive and rapidly
 #		increase hard drive space used with large player populations
 #		if enabled.
-# Retail: true, false, false
+# Retail: true, false, false, false
 LogChat = True
 LogItems = False
 GMAudit = False
+LogGame = False
 
 #============================================================#
 #                     Dev Configuration                      #

+ 2 - 0
L2_GameServer/java/net/sf/l2j/Config.java

@@ -323,6 +323,7 @@ public final class Config
     public static boolean	LOG_CHAT;
     public static boolean	LOG_ITEMS;
     public static boolean	GMAUDIT;
+    public static boolean	LOG_GAME;
     public static boolean	DEBUG;
     public static boolean	ASSERT;
     public static boolean	DEVELOPER;
@@ -1329,6 +1330,7 @@ public final class Config
                 LOG_CHAT									= Boolean.parseBoolean(General.getProperty("LogChat", "false"));
                 LOG_ITEMS									= Boolean.parseBoolean(General.getProperty("LogItems", "false"));
                 GMAUDIT										= Boolean.parseBoolean(General.getProperty("GMAudit", "False"));
+                LOG_GAME									= Boolean.parseBoolean(General.getProperty("LogGame", "False"));
                 DEBUG										= Boolean.parseBoolean(General.getProperty("Debug", "false"));
                 ASSERT										= Boolean.parseBoolean(General.getProperty("Assert", "false"));
                 DEVELOPER									= Boolean.parseBoolean(General.getProperty("Developer", "false"));

+ 24 - 22
L2_GameServer/java/net/sf/l2j/gameserver/lib/Log.java

@@ -38,37 +38,39 @@ public class Log
 	
 	public static final void add(String text, String cat)
 	{
-		/*		Logger _log = logs.get(cat);
+		if(Config.LOG_GAME) {
+			/*		Logger _log = logs.get(cat);
 				if(_log == null)
 				{
 					_log = Logger.getLogger(cat);
 					logs.put(cat, _log);
 				}*/
 
-		String date = (new SimpleDateFormat("yy.MM.dd H:mm:ss")).format(new Date());
+			String date = (new SimpleDateFormat("yy.MM.dd H:mm:ss")).format(new Date());
 		
-		new File("log/game").mkdirs();
+			new File("log/game").mkdirs();
 		
-		try
-		{
-			File file = new File("log/game/" + (cat != null ? cat : "_all") + ".txt");
-			//			file.getAbsolutePath().mkdirs();
-			FileWriter save = new FileWriter(file, true);
-			String out = "[" + date + "] '---': " + text + "\n"; // "+char_name()+"
-			save.write(out);
-			save.flush();
-			save.close();
-			save = null;
-			file = null;
-		}
-		catch (IOException e)
-		{
-			_log.warning("saving chat log failed: " + e);
-			e.printStackTrace();
-		}
+			try
+			{
+				File file = new File("log/game/" + (cat != null ? cat : "_all") + ".txt");
+				//			file.getAbsolutePath().mkdirs();
+				FileWriter save = new FileWriter(file, true);
+				String out = "[" + date + "] '---': " + text + "\n"; // "+char_name()+"
+				save.write(out);
+				save.flush();
+				save.close();
+				save = null;
+				file = null;
+			}
+			catch (IOException e)
+			{
+				_log.warning("saving chat log failed: " + e);
+				e.printStackTrace();
+			}
 		
-		if (cat != null)
-			add(text, null);
+			if (cat != null)
+				add(text, null);
+		}
 	}
 	
 	@Deprecated