Category Archives: logback

Hibernate Logging (e.g. JBOSS logging)

I was getting the following debug logging, even though my logging config said info and above. During my research, I learned that Hibernate is logged via JBoss Logging. It used to require a properties file that denoted which logging implementation … Continue reading

Posted in hibernate, hibernate logging, jboss, jboss logging, jcl-over-slf4j, log4j-over-slf4j, logback, Logging, slf4j | Tagged , , , , , , , , | 1 Comment

Logback log filtering

We wanted to default logging of all messages to warning and above for libraries that we used. We wanted our code to be logged at the info level and above. There was one specific library class that was logging a … Continue reading

Posted in appender, appender configuration, logback, Logging, Logging configuration, slf4j | Tagged , , , , , | Leave a comment

SLF4J to the rescue

Logging is needed, but all of the different frameworks makes this a pain. You are trying to research a problem and you have to bounce from log to log to research it. SLF4J has bridge implementations that delegate to SLF4J … Continue reading

Posted in Java, logback, slf4j | Tagged , , , , , , , , | Leave a comment

How do you add the user id to the logback log?

Create a filter class to add the value to the MDC: Add the filter class to the web.xml Modify the logback pattern to use the value added by the filter to the current logging thread.

Posted in logback | Leave a comment

How do you have different logging levels per environment

This is such a common problem. You want to have one file that you deploy everywhere, but you want it to behave differently based upon where you deploy it. An example is you want logback to log debug in dev, … Continue reading

Posted in logback | Leave a comment

Logback configuration

Maven has two places for configuration files that need to be deployed to the classpath. You need to place a logback configuration file in both. The main logback configuration file is named logback.xml and should be in src/main/resources of your … Continue reading

Posted in logback, Maven | Leave a comment