Skip to content

Commit

Permalink
Fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
simon authored and simon committed Feb 25, 2018
1 parent 8d961ce commit a7d1a00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Server/src/main/java/net/simon987/server/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
public class Main {
public static void main(String[] args) {


LogManager.initialize();
ServerConfiguration config = new ServerConfiguration("config.properties");
LogManager.initialize(config);

//Load
GameServer.INSTANCE.load();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.simon987.server.logging;

import net.simon987.server.ServerConfiguration;

import java.io.IOException;
import java.util.logging.*;

Expand All @@ -16,7 +18,7 @@ public class LogManager {
/**
* Initialises the logger
*/
public static void initialize() {
public static void initialize(ServerConfiguration config) {
LOGGER.setUseParentHandlers(false);

/*
Expand Down Expand Up @@ -45,15 +47,18 @@ public boolean isLoggable(LogRecord record) {
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();
}
Expand Down
4 changes: 2 additions & 2 deletions Server/src/main/resources/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a7d1a00

Please sign in to comment.