Skip to content

Instantly share code, notes, and snippets.

@sachsgit
Created December 2, 2021 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sachsgit/e62f88c3dc0e480e0b70c2d7f5545a12 to your computer and use it in GitHub Desktop.
Save sachsgit/e62f88c3dc0e480e0b70c2d7f5545a12 to your computer and use it in GitHub Desktop.
Log4j 2 Property XML File
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration>
<Configuration status="WARN">
<Appenders>
<File fileName="logs/InfoLogs.log" name="infoFile" append="false">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} | %c{1} %L - %msg%n" />
</File>
<File fileName="logs/ErrorLogs.log" name="errorFile" append="false">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} | %c{1} %l - %msg%n" />
</File>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} | %c{1} %L - %msg%n" />
</Console>
<Console name="STDERR" target="SYSTEM_ERR">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} | %c{1} %L - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef level="DEBUG" ref="infoFile" />
<AppenderRef level="ERROR" ref="errorFile" />
<AppenderRef level="DEBUG" ref="STDOUT" />
</Root>
</Loggers>
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment