2

I have the below entry in the log4j config xml. What is the significant of '%p', '%C;%L', '%m'. What is stands for those characters? What other characters, we can use in log4j? Explain their usage..

<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" 
value="INSERT INTO LOGS (user_id, dated, msg_level, class, message) 
       VALUES ( '%X{MESSAGE_ID}','%d{ISO8601}','%p', '%C;%L', '%m' )" />
</layout>
Karthikeyan Sukkoor
  • 968
  • 2
  • 6
  • 24

1 Answers1

3

Some of the main conversion characters are

p --- Used to output the priority of the logging event.

C --- Used to output the fully qualified class name of the caller issuing the logging request.

L --- Used to output the line number from where the logging request was issued.

m --- Used to output the application supplied message associated with the logging event.

Using number with any conversion character, for example %4p means

the priority of the logging event should be left justified to a width of four characters.

Besides this conversions , there are other patterns also . You can see detail about them here.

vikiiii
  • 9,246
  • 9
  • 49
  • 68