Log4j Simple application

xiaoxiao2021-03-06  41

Log4j Simple Application Profile ### Sets the level INFO and output of the COM domain, A1 ## log4j.category.com = INFO, A1 ### Set Output A1 to File (File size When you get the specified size, a new File) ## log4j.appender.a1 = org.apache.log4j.rollingfileAppender ### file location ## log4j.Appender.a1.file = E: /com.log ### file size ## log4j.Appender. A1.MaxFileSize = 500kblog4j.Appender.a1.maxbackupindex = 1 ### Set A1 output layout format patterlayout, (can flexibly designate the layout mode) ## log4j.Appender.a1.Layout = org.apache.log4j.patternLayout # ## Configure the format format of the log output to the LF5 format ## log4j.Appender.a1.Layout.conversionPattern == [SLF5S.START]% D {Date} [SLF5s.DATE]% N /% P [SLF5s.Priority]% N% x [SLF5S.NDC]% N% T [SLF5S.THREAD]% N /% C [SLF5s.category]% N% L [SLF5S.LOCATION]% N% M [SLF5S.MESSAGE]% N% N setting After this layout, you can use the org.apache.log4j.lf5.util.logmonitoradapter in the log4j package, but now Chinese is a garbled code when I use LogMonitorAdapter to look at log, I haven't thought of solving use: Class TestPrivate static logger logger = Logger.GetLogger (TEST.CLASS.GETNAME ()); Logger.info ("Test"); Logger.Error ("Test"); Logger.warn ("Test");

转载请注明原文地址:https://www.9cbs.com/read-60763.html

New Post(0)