我知道在获取这样的记录器时log4j可以使用类别
org.apache.log4j.Logger.getLogger("category1").warn("debug msg for stdout1 appender");
org.apache.log4j.Logger.getLogger("category2").info("info msg for stdout2 appender");
和log4j.xml
是
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="stdout1" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%.4t] %-5p %c{1} - %m%n" />
</layout>
</appender>
<appender name="stdout2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%.4t] %-5p %c{1} - %m%n" />
</layout>
</appender>
<category name="category1">
<priority value="INFO" />
<appender-ref ref="stdout1" />
</category>
<category name="category2">
<priority value="DEBUG" />
<appender-ref ref="stdout2" />
</category>
</log4j:configuration>
我想知道如何使用lombok @ Slf4j。
代码取自this post