mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-19 17:44:54 +00:00
Fixes #27
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user