-
-
Save maruohon/7290185 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?> | |
<Configuration> | |
<Appenders> | |
<File name="legacy_server_log" fileName="server.log"> | |
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n" /> | |
</File> | |
<Console name="console" target="SYSTEM_OUT"> | |
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n" /> | |
</Console> | |
<RollingFile name="rolling_server_log" fileName="logs/server.log" | |
filePattern="logs/server_%d{yyyy-MM-dd}.log"> | |
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n" /> | |
<Policies> | |
<TimeBasedTriggeringPolicy /> | |
</Policies> | |
</RollingFile> | |
</Appenders> | |
<Loggers> | |
<Root level="info"> | |
<!-- <AppenderRef ref="rolling_server_log" /> --> | |
<AppenderRef ref="legacy_server_log" /> | |
<AppenderRef ref="console" /> | |
</Root> | |
</Loggers> | |
</Configuration> |
Thanks! Saved me the time and hassle of doing this myself.
This is great, but it breaks the console output. I'm trying to figure out a solution.
How does it break it? It was supposed to work/output exactly the way it worked before 1.7, and afaik it does that on all of my servers.
I love my logs to be at one place, but it turns out, adding that option "-Dlog4j.configurationFile=log4j2.xml" makes my server eat 100%+ CPU time on empty and idle server. Do you have any idea why?
Its on Linux laptop 3.12.2-1-ARCH x86_64 GNU/Linux
and also on
Linux Ubuntu 2.6.35-22-server x86_64 x86_64 x86_64 GNU/Linux
Best regards
EDIT:
Well, https://gist.github.com/EvilSeph/7909975 works fine for me. Maybe I edited badly your xml, maybe not.
Thank you for this! I've been looking for a way to control Forge logging for some time.
sooo confused xD
Place the file to the same directory as your minecraft_server.jar, and add
-Dlog4j.configurationFile=log4j2.xml
to your server startup arguments.The given configuration mimics the old logging behaviour.
If you want daily rolled logs, uncomment the
<AppenderRef ref="rolling_server_log" />
line (and probably comment out the the legacy_server_log since you don't then want that?). For compressed rolled logs, add .gz to the end of the filePattern's filename pattern (logs/server_%d{yyyy-MM-dd}.log.gz
).