The program is log4net print log, I am not a log printing problem, the log4net configuration of the program is as follows:
1<log4net>2<root>3<level value=" All"/>4<appender-ref ref="Rollinglogfileappender"/>5<appender-ref ref="Consoleappender"/>6</root>7<!--logger logger, can have multiple--8<logger name="FileLog">9<level value=" All"/>Ten<appender-ref ref="Consoleappender"/> One<appender-ref ref="Rollinglogfileappender"/> A</logger> -<appender name="Consoleappender"Type="log4net. Appender.consoleappender"> -<layout type="log4net. Layout.patternlayout"> the<param name="Conversionpattern"Value="%d [%t]%-5p%c [%x]-%m%n"/> -</layout> -</appender> -<appender name="Rollinglogfileappender"Type="log4net. Appender.rollingfileappender"> +<param name="File"Value="Logs/pekingvms"/> -<param name="Appendtofile"Value="true"/> +<!--cutting maximum number of files-1 means no limit on the number of log files generated-- A<param name="maxsizerollbackups"Value="-1"/> at<param name="Encoding"Value="Utf-8"/> -<!--size limit per file-- -<param name="maximumFileSize"Value="100MB"/> -<param name="Lockingmodel"Type="log4net. Appender.fileappender+minimallock"/> -<param name="Staticlogfilename"Value="false"/> -<param name="Datepattern"Value="Yyyymmdd". log""/> in<param name="Rollingstyle"Value="Composite"/> -<layout type="log4net. Layout.patternlayout"> to<param name="Conversionpattern"Value="%d [%t]%-5p%c [%x]-%m%n"/> +</layout> -</appender> the</log4net>
Patternlayout related configuration information is as follows:
-X: left-aligned when the information is output, %p: Output log information priority, which is debug,info,warn,error,fatal, %d: the date or time of the output log point in time, the default format is ISO8601, can also be specified after the format, such as:%d{yyy MMM DD hh:mm:ss,sss}, the output is similar to: October 18, 2002 22:10:28,921 %r: Output from the application boot to output the log information the number of milliseconds spent %c: The class that the output log information belongs to is usually the full name of the class %t: the name of the thread that produces the log event is output %l: The location of the output log event, equivalent to the combination of%c.%m (%f:%l), including the class name, the thread that occurred, and the number of rows in the code. Example: Testlog4.main (testlog4.java:10) %x: The NDC (nested diagnostic environment) associated with the output and current line threads, especially for multi-client multithreaded applications like Java Servlets. %%: Output A "%" character %f: The name of the file where the output log message was generated %l: The line number in the output code %m: The message specified in the output code, the resulting log details %n: output a carriage return newline character, Windows platform for "/r/n", UNIX Platform for "/n" output log message wrap Log only print the time, field ID, priority, class name, there is no, guess is%x can not get, cause the log content is not printed later, so instead:
1 <layout type="log4net. Layout.patternlayout">2 <param name="conversionpattern" value="%d [%t]%-5p%c-%m%n"/>3 </layout>
Later, after a test, send the post of the log print success.
Log4net Log printing is not complete