hance 2015-04-06
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <!-- 业务日志,生产环境使用。 --> <appender name="APPMGR_LOG" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="log/appmgr.log" /> <param name="Append" value="true" /> <param name="DatePattern" value="'_'yyyy-MM-dd-HH'.log'" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%p][%d{yyyy-MM-dd HH\:mm\:ss,SSS}][%t][%c]%m%n" /> </layout> </appender> <!-- JOP框架底层日志,分析框架问题时使用。 --> <!-- <appender name="JOP_LOG" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="log/jop.log" /> <param name="Append" value="true" /> <param name="DatePattern" value="'.'yyyy-MM-dd-HH" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %t (%F,%L) - %m%n" /> </layout> </appender> --> <!-- 控制台日志,开发阶段使用--> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out" /> <param name="Threshold" value="DEBUG"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%p][%d{yyyy-MM-dd HH\:mm\:ss,SSS}][%t][%c]%m%n" /> </layout> </appender> <!-- 默认的异步文件日志输出,生产环境都采用此appender --> <appender name="ASYNC_APPMGR_LOG" class="org.apache.log4j.AsyncAppender"> <param name="BufferSize" value="256"/> <param name="LocationInfo" value="true"/> <appender-ref ref="APPMGR_LOG"/> </appender> <!-- 默认的异步文件日志输出,生产环境都采用此appender --> <!-- <appender name="ASYNC_JOP_LOG" class="org.apache.log4j.AsyncAppender"> <param name="BufferSize" value="512"/> <param name="LocationInfo" value="true"/> <appender-ref ref="JOP_LOG"/> </appender> --> <!-- console 异步日志,开发环境都使用此appender,方便调试 --> <appender name="ASYNC_CONSOLE" class="org.apache.log4j.AsyncAppender"> <param name="BufferSize" value="64"/> <param name="LocationInfo" value="true"/> <appender-ref ref="CONSOLE"/> </appender> <!-- 监控数据,启用监控功能时使用 --> <!-- <appender name="MONITOR_SQLLOG" class="com.xxx.xxxx.infrastructure.log4j.JDBCExtAppender"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="URL" value="jdbc:oracle:thin:@10.200.5.200:1521:BOSS15TEST"/> <param name="User" value="jop"/> <param name="Password" value="jp"/> <param name="sql" value="insert into SYS_ACCTMONITOR(ID,STARTTIME, USETIME,PARENTFLOWNO,IP,CLIENT,OPERATOR,TARGETSYSTEM,TARGETMODULE,TARGETFUNCTION,TARGETOPERATION,PARAMLIST,RESULTSTATUS,RESULTCODE) values (SYS_ACCTMONITOR_SEQ.nextval,to_timestamp('@starttime@','yyyy-MM-dd hh24:mi:ss.ff'), @usetime@, '@parentflowno@','@ip@','@client@','@operator@','@targetsystem@','@targetmodule@','@targetfunction@','@targetoperation@','@paramlist@','@resultstatus@','@resultcode@')"/> </appender> --> <!-- 监控数据记录异步化,只能给监控 com.xxx.xxxx.monitor 使用,其他logger不得使此 appender --> <appender name="ASYNC_MONITOR_SQLLOG" class="org.apache.log4j.AsyncAppender"> <param name="BufferSize" value="1024"/> <param name="LocationInfo" value="true"/> <appender-ref ref="MONITOR_SQLLOG"/> </appender> <!-- 监控需要特殊控制,输出到自己的appender --> <!-- <category name="com.xxx.xxxx.monitor"> <param name="additivity" value="false"/> <priority value="DEBUG" /> <appender-ref ref="ASYNC_MONITOR_SQLLOG" /> </category> --> <category name="org.hibernate.type"> <param name="additivity" value="false"/> <priority value="WARN" /> <appender-ref ref="ASYNC_APPMGR_LOG" /> <!-- ASYNC_Hibernate_SQL --> </category> <!-- 默认所有业务日志输出到文件 appmgr.log, 异步输出; 其他特殊控制,如:缓存日志输出到jop.log --> <root> <priority value="INFO" /> <appender-ref ref="ASYNC_APPMGR_LOG" /> <!-- 生产环境 ASYNC_APPMGR_LOG --> </root> </log4j:configuration>
tomcat优化:
http://blog.csdn.net/lifetragedy/article/details/7708724