Do the project is log4j output format parameters annoying, simply put the relevant parts of the API roughly translated, the original see http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html
Parameter Description Example
%c lists the full name of the logger namespace, and if the addition of the {< layer indicates the name space that lists the specified number of layers from the most inner layer log4j profile parameter example output display media
Suppose the current logger namespace is "A.B.C"
%c A.B.C
%C{2} B.C
%20C (if the name space length is less than 20, then the left with a space padding)
%-20C (if the name space length is less than 20, then the right with a space padding)
%.30C (if the name space is longer than 30, truncate the extra characters)
%20.30C (if the name space length is less than 20, then the left is padded with a space; If the name space is longer than 30, the extra characters are truncated)
%-20.30C (if the name space length is less than 20, then the right is padded with a space; If the name space is longer than 30, truncate the extra character)
%c lists the full name of the class that invokes logger (including the package path) assuming that the current class is "Org.apache.xyz.SomeClass"
%c Org.apache.xyz.SomeClass
%c{1} SomeClass
%d display logging time,{< date format using ISO8601-defined date format%d{yyyy/mm/dd hh:mm:ss,sss} 2005/10/12 22:23:30,117
%d{absolute} 22:23:30,117
%d{date 2005 22:23:30,117
%d{iso8601} 2005-10-12 22:23:30,117
%F Displays the source file name of the calling logger%F Myclass.java
%l the location where the output log event occurs, including the class name, the thread that occurred, and the number of rows in the Code%l myclass.main (myclass.java:129)
%l shows the line of code that calls logger%l 129
%M Displays the output message%m This is a messages for debug.
%M Displays the method name of the calling logger%m main
%n the line break under the current platform%n the RN under Windows platform
The Unix platform represents N
%p Display the priority of this log%p INFO
%r shows the number of milliseconds that have elapsed since the start of the program to record this log%r 1215
The%t output produces the thread name of the log event%t MyClass
%x Presses NDC (Nested diagnostic context, thread stack) sequential output log to assume that a program call order is MyApp invocation Com.foo.Bar
%c%x-%m%n myapp-call Com.foo.Bar.
Com.foo.bar-log in Bar
Myapp-return to MYAPP.
%x outputs logs by MDC (mapped diagnostic context, thread mapping table). It is commonly used for multiple clients to connect to the same server, which makes it easier for the server to differentiate between the logs that the client accesses. %x{5} (log of the client with the record code number 5)
Percent per cent showed a% percent%
Here are a few examples of this, such as the log4j.properties content:
#log4j Config
Log4j.rootlogger=debug,output
Log4j.appender.output.layout=org.apache.log4j.patternlayout
Log4j.appender.output.layout.conversionpattern=%d{date}%-4r [%t]%-5p%c%x-%m%n
......
Then one possible output is:
OCT 22:23:30,117 0 [main] INFO myapp-entering application.
......
OCT 22:23:30,162 [main] INFO myapp-exiting application.