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 static void main(String[] args) {
LogManager.initialize();
ServerConfiguration config = new ServerConfiguration("config.properties");
LogManager.initialize(config);
//Load
GameServer.INSTANCE.load();

View File

@ -1,5 +1,7 @@
package net.simon987.server.logging;
import net.simon987.server.ServerConfiguration;
import java.io.IOException;
import java.util.logging.*;
@ -16,7 +18,7 @@ public class LogManager {
/**
* Initialises the logger
*/
public static void initialize() {
public static void initialize(ServerConfiguration config) {
LOGGER.setUseParentHandlers(false);
/*
@ -45,15 +47,18 @@ public class LogManager {
handler.setLevel(Level.ALL);
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.setFormatter(new GenericFormatter());
LOGGER.addHandler(handler);
LOGGER.addHandler(errHandler);
LOGGER.addHandler(fileHandler);
LOGGER.setLevel(Level.ALL);
} catch (IOException e) {
e.printStackTrace();
}

View File

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