Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<properties>
<property name="name">app</property>
<property name="pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} | %-5.5p | %-10.10t | %-20.20C:%-5.5L | %msg%n</property>
<!--
It will look like that:
2013-04-03 07:37:51.993 | WARN | main | lnetgateway.Server:56 | My app is logging stuff
-->
</properties>
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="${pattern}"/>
</Console>
<RollingFile name="RollingFile" fileName="logs/${name}.log"
filePattern="logs/$${date:yyyy-MM}/${name}-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<pattern>${pattern}</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
<SizeBasedTriggeringPolicy size="100 MB"/> <!-- Or every 100 MB -->
</Policies>
</RollingFile>
</appenders>
<loggers>
<root level="debug"> <!-- We log everything -->
<appender-ref ref="Console"/> <!-- To console -->
<appender-ref ref="RollingFile"/> <!-- And to a rotated file -->
</root>
</loggers>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<properties>
<property name="servicename">m2mp_checker</property>
<property name="filename">/var/log/m2mp/${servicename}.log</property>
<property name="patternTime">%d{yyyy-MM-dd HH:mm:ss.SSS} | %-5.5p | %-10.10t | %-20.20C:%-5.5L | %msg%n</property>
<property name="patternNoTime">%-5.5p | %-10.10t | %-20.20C:%-5.5L | %msg%n</property>
</properties>
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="${patternTime}"/>
</Console>
<File name="file" fileName="${filename}">
<PatternLayout pattern="${patternTime}"/>
</File>
<Syslog name="syslog" host="localhost" port="514" protocol="UDP" appName="${servicename}">
</Syslog>
</appenders>
<loggers>
<root level="info">
<appender-ref ref="file"/>
<appender-ref ref="console"/>
<appender-ref ref="syslog"/>
</root>
</loggers>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment