Skip to content

Instantly share code, notes, and snippets.

@RoboMWM
Forked from EvilSeph/log4j2.xml
Last active June 13, 2017 06:38
Show Gist options
  • Save RoboMWM/f6d389b91210a885ac659f9010e51aa6 to your computer and use it in GitHub Desktop.
Save RoboMWM/f6d389b91210a885ac659f9010e51aa6 to your computer and use it in GitHub Desktop.
Bukkit 1.6 style logging log4j2 configuration (includes thread and log level in console and file) - Note that an update to log4j has caused the append parameter to be false by default. Also note that yet another update uses TerminalConsole instead of queue.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<TerminalConsole name="TerminalConsole">
<PatternLayout pattern="%highlightError{%d{yyyy-MM-dd HH:mm:ss} [%t/%level] %minecraftFormatting{%msg}%n%xEx}" />
</TerminalConsole>
<RandomAccessFile name="File" fileName="server.log" append="true">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%t/%level] %minecraftFormatting{%msg}{strip}%n" />
</RandomAccessFile>
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="WINDOWS_COMPAT"/>
<AppenderRef ref="File"/>
<AppenderRef ref="TerminalConsole"/>
</Root>
</Loggers>
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment