Sorry for this very basic question, but I spent a lot of time and research on that and can't get it to work :-/ What I want: Show all loggings on INFO level, but my application on DEBUG level. My setup and understanding so far is:
In my WildFly I am using slf4j with logback. I did not configure logback at all b/c this is done within the WildFly configuration. This my pom:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
This is my logger configuration:
<console-handler name="CONSOLE">
<level name="DEBUG"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="jacorb">
<level name="WARN"/>
</logger>
<logger category="org.hibernate">
<level name="INFO"/>
</logger>
<logger category="javax">
<level name="INFO"/>
</logger>
<logger category="com.sample.application" use-parent-handlers="false">
<level name="DEBUG"/>
<handlers>
<handler name="CONSOLE"/>
</handlers>
</logger>
<root-logger>
<level name="DEBUG"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
So the handlers and the root logger must stay on debug, otherwise no debug level log will come through. But then everything else, e.g. [org.jboss.as.controller.management-operation] comes through on debug level as well, and I can't manually set everything to INFO level. Where am I wrong? Thanks in advance!
Leave the console-handler
level on DEBUG
, change the root-logger
level back to INFO
, and simply change your application logger to
<logger category="com.sample.application">
<level name="DEBUG"/>
</logger>
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