JBoss 7: Equivalent to jboss-log4j.xml

jboss7.x, logging, slf4j

Solution

You can add a logback configuration to your application. You would need to include logback in your application. You might have to use a jboss-deployment-structure.xml, similar to the log4j exclusion one, to exclude the `org.slf4j` module. This will only configure logging for your application though.

If you're concern is just getting the logging subsystem configured there are a couple other possibilities that could work depending on your environment.

The first and one that would work with any environment is create a CLI script that could be checked in and run.

${JBOSS_HOME}/bin/jboss-cli.sh --connect --file path/to/script.cli

If you're using maven the second possibility would be to use the maven plugin. You can execute CLI commands with the plugin. Just add the `execute-commands` goal to run before the deploy goal runs.

Problem

I don't want to configure the logging using the standalone.xml or CLI, because it requires additional steps for my colleagues to get a working development environment. I want to have these configuration files checked in with our source code and automatically applied at deployment time. With JBoss 5 there was the possibility to declare logging in the jboss-log4j.xml. Is there an equivalent to this file in JBoss 7, too? We want to use slf4j and logback.

Original source

Related problems