Following is the sample n simple configuration file (file name MUST be log4j2.xml)
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="ivr-log-path">C:/mytemp/ivrLogs</Property>
</Properties>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
</Console>
<RollingFile name="rollingFile" filename="${ivr-log-path}/myexampleRK.log" filepattern="${ivr-log-path}/myexampleRK_fargo.log.%i">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="10 KB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="rollingFile" />
<AppenderRef ref="console" />
<!-- Use FLOW to trace down exact method sending the msg -->
<!-- <AppenderRef ref="FLOW" /> -->
</Root>
</Loggers>
</Configuration>
PS: used http://codebeautify.org/xml-escape-unescape for encoding XML
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="ivr-log-path">C:/mytemp/ivrLogs</Property>
</Properties>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
</Console>
<RollingFile name="rollingFile" filename="${ivr-log-path}/myexampleRK.log" filepattern="${ivr-log-path}/myexampleRK_fargo.log.%i">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="10 KB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="rollingFile" />
<AppenderRef ref="console" />
<!-- Use FLOW to trace down exact method sending the msg -->
<!-- <AppenderRef ref="FLOW" /> -->
</Root>
</Loggers>
</Configuration>
PS: used http://codebeautify.org/xml-escape-unescape for encoding XML
No comments:
Post a Comment