log4j.properties的配置

log4j.rootLogger=info, Console, RollingFile
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.appender.RollingFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.RollingFile.DatePattern='.'yyyyMMdd'.log'
log4j.appender.RollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.RollingFile.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.appender.RollingFile.encoding=UTF-8

log4j.logger.com.tempus=info,db 
log4j.appender.db=org.apache.log4j.jdbc.JDBCAppender 
log4j.appender.db.user=uds 
log4j.appender.db.driver=oracle.jdbc.driver.OracleDriver
log4j.appender.db.sql=insert into T_LOG4J_LOG (LOGIN_NAME,USER_NAME,CLASS_NAME,METHOD_NAME,CREATE_TIME,LOG_LEVEL,MSG) values ('%X{userId}','%X{userName}','%C','%M','%d{yyyy-MM-dd HH\:mm\:ss}','%p','%m') 

#生产服务器 172.16.2.115--windons 172.16.12.35--linux
log4j.appender.RollingFile.File=D://log//uds.log
#log4j.appender.RollingFile.File=/var/www/logs/uds.log

#测试环境
log4j.appender.db.BufferSize=1 
log4j.appender.db.URL=jdbc:oracle:thin:@172.16.3.101:1521:ticketdb
log4j.appender.db.password=tempus
log4j.logger.java.sql.Connection=debug
log4j.logger.java.sql.Statement=debug
log4j.logger.java.sql.PreparedStatement=debug

#生产环境
#log4j.appender.db.BufferSize=10
#log4j.appender.db.URL=jdbc:oracle:thin:@172.16.2.147:1521:tempus
#log4j.appender.db.password=urad89Awss


 

你可能感兴趣的:(log4j.properties的配置)