<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="CUSTOMER_FILE_LOG"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/system/system.log" />
<param name="Append" value="true" />
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="100000KB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSSZ} %-5r %-5p [%c{1}] (%t:%x) %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="TRAFFIC_FILE_LOG"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/traffic/traffic.log" />
<param name="Append" value="true" />
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="100000KB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} %-5p [%c{1}] (%t:%x) %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="BADMSG_FILE_LOG"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/badmsg/badmsg.log" />
<param name="Append" value="true" />
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="100000KB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} %-5p [%c{1}] (%t:%x) %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="CONFIG_FILE_LOG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/config/config.log" />
<param name="Append" value="true"/>
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="500KB"/>
<param name="MaxBackupIndex" value="2"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSSZ} [%c{1}] %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="STATISTICS_FILE_LOG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/statistics/statistics.log" />
<param name="Append" value="true" />
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="100000KB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSSZ} %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="STATISTICS_FORMAT_FILE_LOG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/statistics/statistics.log" />
<param name="Append" value="true" />
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="100000KB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- A size based rolling appender -->
<!-- ============================== -->
<appender name="EVENTLOGGER_FILE_SIZE"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${oracle.j2ee.home}/log/sdp/events.log" />
<param name="Append" value="true" />
<param name="Encoding" value="UTF-8" />
<param name="MaxFileSize" value="100000KB" />
<param name="MaxBackupIndex" value="10" />
<layout class="oracle.sdp.eventlogger.BasicLayout"></layout>
</appender>
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="ERROR" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSSZ} %-5p [%c{1}] %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- Append to TCP SOCKET -->
<!-- ============================== -->
<appender name="SYSTEM_SOCKET"
class="org.apache.log4j.net.SocketAppender">
<param name="RemoteHost" value="127.0.0.1" />
<param name="Port" value="4477" />
<param name="Threshold" value="DEBUG" />
</appender>
<!-- ============================== -->
<!-- Syslog events -->
<!-- ============================== -->
<appender name="TRAFFIC_SYSLOG"
class="org.apache.log4j.net.SyslogAppender">
<param name="Threshold" value="INFO" />
<param name="Facility" value="LOCAL1" />
<!-- param name="FacilityPrinting" value="false"/ -->
<param name="SyslogHost" value="127.0.0.1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSSZ} %-5r %-5p [%c] (%t:%x) %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- Syslog events -->
<!-- ============================== -->
<appender name="SYSTEM_SYSLOG"
class="org.apache.log4j.net.SyslogAppender">
<param name="Threshold" value="ERROR" />
<param name="Facility" value="LOCAL0" />
<!-- param name="FacilityPrinting" value="false"/ -->
<param name="SyslogHost" value="127.0.0.1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSSZ} %-5r %-5p [%c] (%t:%x) %m%n" />
</layout>
</appender>
<!-- ============================== -->
<!-- Syslog events -->
<!-- ============================== -->
<appender name="EVENTLOGGER_SYSLOG"
class="org.apache.log4j.net.SyslogAppender">
<param name="Threshold" value="ALL" />
<param name="Facility" value="LOCAL2" />
<!-- param name="FacilityPrinting" value="false"/ -->
<param name="SyslogHost" value="127.0.0.1" />
<layout class="oracle.sdp.eventlogger.BasicLayout"></layout>
</appender>
Оригинал
Полезная статья о сути appender-ов
Простой и понятный пример настройки
Комментариев нет:
Отправить комментарий