This commit is contained in:
simon 2018-02-25 08:51:03 -05:00
parent 8d961ce572
commit a7d1a00ae8
3 changed files with 11 additions and 6 deletions

View File

@ -9,9 +9,9 @@ import java.net.InetSocketAddress;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
LogManager.initialize();
ServerConfiguration config = new ServerConfiguration("config.properties"); ServerConfiguration config = new ServerConfiguration("config.properties");
LogManager.initialize(config);
//Load //Load
GameServer.INSTANCE.load(); GameServer.INSTANCE.load();

View File

@ -1,5 +1,7 @@
package net.simon987.server.logging; package net.simon987.server.logging;
import net.simon987.server.ServerConfiguration;
import java.io.IOException; import java.io.IOException;
import java.util.logging.*; import java.util.logging.*;
@ -16,7 +18,7 @@ public class LogManager {
/** /**
* Initialises the logger * Initialises the logger
*/ */
public static void initialize() { public static void initialize(ServerConfiguration config) {
LOGGER.setUseParentHandlers(false); LOGGER.setUseParentHandlers(false);
/* /*
@ -45,15 +47,18 @@ public class LogManager {
handler.setLevel(Level.ALL); handler.setLevel(Level.ALL);
try { try {
Handler fileHandler = new FileHandler("mar.log"); Handler fileHandler = new FileHandler("mar-%g.log", config.getInt("log_limit"),
config.getInt("log_count"));
fileHandler.setLevel(Level.ALL); fileHandler.setLevel(Level.ALL);
fileHandler.setFormatter(new GenericFormatter()); fileHandler.setFormatter(new GenericFormatter());
LOGGER.addHandler(handler); LOGGER.addHandler(handler);
LOGGER.addHandler(errHandler); LOGGER.addHandler(errHandler);
LOGGER.addHandler(fileHandler); LOGGER.addHandler(fileHandler);
LOGGER.setLevel(Level.ALL); LOGGER.setLevel(Level.ALL);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -6,8 +6,8 @@ mysql_pass=mar
mysql_url=jdbc:mysql://localhost:3306/mar?useSSL=false mysql_url=jdbc:mysql://localhost:3306/mar?useSSL=false
# File management # File management
save_interval=5 save_interval=5
clean_interval=10 log_limit=2000000
history_size=10 log_count=10
# Web server port # Web server port
webSocket_port=8887 webSocket_port=8887
webSocket_host=0.0.0.0 webSocket_host=0.0.0.0