1.log4j.properties的配置详解
# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
#根目录(级别(ERROR,WARN,INFO,DEBUG 高到低)和目的地(可以指定多个输出目的地,stdout控制台,logfile文本文件))
log4j.rootLogger=INFO, stdout, logfile
#输出到控制台(默认为追加方式);Appender-日志目的地(控制台,文件等等),把格式化好的日志信息输出到指定的地方去
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#输出样式(控制日志信息的显示内容),用指定的pattern格式化logingg request的Layout;Layout-日志格式化器,用来把程序员的#logging request格式化成字符串;可以灵活地指定布局模式
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#自定义样式
#%d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},输出类似:2002年#10月18日 22:10:28,921
#%p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
#%c 输出所属的类目,通常就是所在类的全名(包括包名)
#%m 输出代码中指定的讯息,如log(message)中的message
#%n 输出一个回车换行符,Windows平台为“rn”,Unix平台为“n”
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
#文件大小到达指定尺寸的时候生成一个新的文件
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
#设置文件输出路径,文本文件
log4j.appender.logfile.File=${wap.root}/WEB-INF/wap.log
#文件指定大小
log4j.appender.logfile.MaxFileSize=512KB
# Keep 9 backup files.
log4j.appender.logfile.MaxBackupIndex=9
# Pattern to output: date priority [category] - message
#logging request格式化成字符串;可以灵活地指定布局模式
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
#wap是包名(wap.logs); log是输出目的地即/usr/local/zhou/resin/phones
log4j.logger.wap=INFO, log
#每天产生一个日志文件
log4j.appender.log=org.apache.log4j.DailyRollingFileAppender
# log4j.appender.log.File=${wap.root}/logs/logs
log4j.appender.log.File=/usr/local/zhou/resin/phones
#指定年月日的格式为2009-12-24
log4j.appender.log.DatePattern='.'yyyy-MM-dd
log4j.appender.log.layout=org.apache.log4j.PatternLayout
log4j.appender.log.layout.ConversionPattern=%d|%m%n
log4j.logger.unicom=INFO, unicom
#每天产生一个日志文件
log4j.appender.unicom=org.apache.log4j.DailyRollingFileAppender
# log4j.appender.log.File=${wap.root}/logs/logs
log4j.appender.unicom.File=/usr/local/zhou/resin/unicom
log4j.appender.unicom.DatePattern='.'yyyy-MM-dd
log4j.appender.unicom.layout=org.apache.log4j.PatternLayout
log4j.appender.unicom.layout.ConversionPattern=%d|%m%n
log4j.logger.user=INFO, user
#每天产生一个日志文件
log4j.appender.user=org.apache.log4j.DailyRollingFileAppender
log4j.appender.user.File=/usr/local/zhou/resin/user
log4j.appender.user.DatePattern='.'yyyy-MM-dd
log4j.appender.user.layout=org.apache.log4j.PatternLayout
log4j.appender.user.layout.ConversionPattern=%d|%m%n
2.生成的部分日志文件phones
2009-12-24 17:27:42,485|http://wap.lenovomobile.com/index.do?ua=i300|null||211.136.222.98|GET|Accept=application/xhtml+xml; profile=http://www.wapforum.org/xhtml, application/vnd.wap.xhtml+xml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, text/vnd.wap.wml, text/vnd.sun.j2me.app-descriptor, application/java-archive, image/vnd.wap.wbmp, image/gif, image/bmp, image/png, audio/amr, audio/imelody, audio/midi, audio/wav, application/vnd.wap.wtls-ca-certificate, application/x-x509-ca-cert, application/vnd.wap.hashed-certificate, application/vnd.wap.signed-certificate, */*, text/html
Accept-Charset=utf-8, utf-16, iso-8859-1, iso-10646-ucs-2, GB18030, GB2312, windows-1252, us-ascii
Accept-Language=zh-tw, zh-cn, en
Connection=close
Host=wap.lenovomobile.com
Via=ZXWAP GateWay,ZTE Technologies
x-forwarded-for=10.217.198.240
SCRIPT_URL=/i300
SCRIPT_URI=http://wap.lenovomobile.com:80/i300
||
2009-12-24 17:27:42,492|http://wap.lenovomobile.com/bookmark.do?id=9|null||211.137.59.23|GET|accept=text/html, application/vnd.wap.wmlc, text/plain, multipart/mixed, image/gif, image/jpeg, image/vnd.wap.wbmp, application/vnd.wap.wbxml, text/vnd.wap.si, text/vnd.wap.sl, application/vnd.wap.multipart.related, application/vnd.wap.sia, application/vnd.wap.wmlscriptc, application/vnd.wap.xhtml+xml, audio/midi, audio/mid, audio/x-midi, audio/x-mid, audio/sp-midi, audio/amr, audio/mp3, audio/mpeg, application/vnd.wap.mms-message, image/vnd.ziyitong.drm, image/vnd.ziyitong.vis, image/vnd.ziyitong.zdd, application/xhtml+xml, video/3gpp, audio/mp4, video/mp4, image/png, image/bmp, text/x-vcard, text/x-vcalendar, text/vnd.wap.wml, text/vnd.wap.wmlscript
accept-charset=UTF-8; Q=0.8
accept-language=en
Connection=close
Host=wap.lenovomobile.com
Via=WTP/1.1 HBWH-PS-WAP-GW09.hbwh.monternet.com (Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)
X-Forwarded-For=10.202.37.48
X-Nokia-CONNECTION_MODE=CMODE
X-Nokia-gateway-id=NWG/4.1/Build4.1.04
X-Source-ID=GGSNWH07Ber
x-up-bear-type=GPRS/ EDGE
X-Up-Bearer-Type=GPRS
SCRIPT_URL=/Bookmark/9/go.net
SCRIPT_URI=http://wap.lenovomobile.com:80/Bookmark/9/go.net
||