Skip to content
Advertisement

SLF4J logging with jboss/wildfly 10

I have a Java webapp running in a WildFly 10 server. I used to have the following libraries as Maven dependencies:

JavaScript

I would now like to use wildfly’s builtin logging subsystem.

  • Which libraries do I need to add to my project(s)?
  • How do I configure the default log-category and root logger declared in standalone.xml to log everything from packages “com.mycompany” at level “debug”?
  • I’m running the wildfly server as a plugin in my eclipse. By using the console handler, I want the logs to be written to the console of Eclipse

Currently, it isn’t working and I’m not sure which of the 3 steps have I have misconfigured. Here’s a snippet from standalone.xml:

JavaScript

Advertisement

Answer

What you have in your standalone.xml is correct. However you’re including too many slf4j dependencies. slf4j is meant to be a logging facade first. There is no need to include implementation dependencies in your application.

First you’ll want to remove the log4j2 dependencies from your pom. Then mark the org.slf4j:slf4j-api as <scope>provided</scope> as the container already provides that dependency for you. That should be all you need to do.

Advertisement