javalog4jpattern-layout

Log4j PatternLayout - Prepend value to %c


My current Conversion Pattern within my log4j.xml file is as follows:

<param name="ConversionPattern" value="%d (%F:%L) %-5p %c - %m%n"/>

I have a simple requirement to prepend %c (which is 'ERROR') with the word 'Runtime'. Using the pattern layout is there anyway I can simply add this word into the pattern for it to print out to the log file?

Thanks in advance.


Solution

  • Just add the string to the pattern:

    %d (%F:%L) %-5p Runtime%c - %m%n