I have a pattern to output to console and log file in following format:
[INFO] 17:31:12 - Checking Bla Bla Bla
[INFO] 17:31:12 - ************* Starting *********************
[INFO] 17:31:12 - Testing Begins
is there any way to append line count so that it looks like:
[001][INFO] 17:31:12 - Checking Bla Bla Bla
[002][INFO] 17:31:12 - ************* Starting *********************
[003][INFO] 17:31:12 - Testing Begins
In Log4j 1, the symbols can be seen here http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
Line Number is %L.
In Log4j 2, the symbol is also %L
https://logging.apache.org/log4j/2.0/manual/layouts.html#Pattern_Layout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With