I already configured logback file to get classname, method name and line number.
<pattern> %d{HH:mm:ss.SSS} [%thread] %-5level %class{36}.%M %L - %msg%n </pattern>
I want to print log message when entering and existing method. How can i do that within the class using info() method. I used the code below. But it didnt print what i wanted.
I use org.slf4j.Logger and Logback logging
LOG.info("Entering " + );
This is what I got :
14:41:48.097 [main] INFO c.a.j.orgchart.CsvPersonReader - Entering
I want to print something like this:
14:41:48.097 [main] INFO c.a.j.orgchart.CsvPersonReader.[MethodName] [Linenumber] - Entering
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %class{36}.%M %L - %msg%n</pattern>
</encoder>
</appender>
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