Since Log4J2's org.apache.logging.log4j.core.layout.PatternLayout
Class is final
, I can't extend it to create headers for my CSV.
I referred docs, it doesn't provide info on how to extend existing Layout. http://logging.apache.org/log4j/2.x/manual/extending.html#Layouts
Previous approach of extending PatternLayout doesn't work.
My goal is to add header to log file & headers should be configured through configuration file for below log,
<File name="MttPerformance" fileName="logs\MyLog.csv" append="true">
<PatternLayout pattern="%d{dd MMM yyyy},%d{HH:mm:ss,SSS},%m%n"/>
</File>