配置文件java
log4j.rootLogger=info,A0 #info,A0 #log4j.logger.org.springframework=FATAL #log4j.logger.org.hibernate=FATAL # debug info log4j.logger.stdout=info,A0 log4j.additivity.stdout=false #log4j.appender.A0=org.apache.log4j.ConsoleAppender log4j.appender.A0=org.apache.log4j.DailyRollingFileAppender log4j.appender.A0.File=${catalina.home}/logs/gopLogs/out.log log4j.appender.A0.DatePattern='_'yyyy-MM-dd log4j.appender.A0.encoding=gb2312 log4j.appender.A0.layout=org.apache.log4j.PatternLayout log4j.appender.A0.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c - %m%n # debug info log4j.logger.syslog=info,A1 log4j.additivity.syslog=false #log4j.appender.A0=org.apache.log4j.ConsoleAppender log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender log4j.appender.A1.File=${catalina.home}/logs/gopLogs/sys.log log4j.appender.A1.DatePattern='_'yyyy-MM-dd log4j.appender.A1.encoding=gb2312 log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c - %m%n #log4j.debug=DEBUG log4j.logger.roomlog=info,A2 log4j.additivity.roomlog=false log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender log4j.appender.A2.File=${catalina.home}/logs/gopLogs/roomlog.log log4j.appender.A2.DatePattern='_'yyyy-MM-dd-HH log4j.appender.A2.encoding=gb2312 log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c - %m%n
調用spring
public class Logs { /** * 普通輸出,主要用於調試 */ public static final Logger logger_out = Logger.getLogger("stdout"); /** * 鏈接(登陸,註冊)日誌,用於日誌入庫 */ public static final Logger logger_conn = Logger.getLogger("conn"); /** * 聊天室日誌,用於日誌入庫處理 */ public static final Logger logger_roomlog = Logger.getLogger("roomlog");
原帖:http://blog.csdn.net/maosijunzi/article/details/17378767apache