Bug 986864 - Migration Guide for Logging in EAP 6.1 is incomplete
Migration Guide for Logging in EAP 6.1 is incomplete
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: GA
: EAP 6.3.0
Assigned To: sgilda
Russell Dickenson
: Documentation, Triaged
Depends On:
  Show dependency treegraph
Reported: 2013-07-22 05:33 EDT by Thies Rubarth
Modified: 2014-09-29 14:36 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Build: CSProcessor Builder Version 1.11 Build Name: 11863, Migration Guide-6.1-4 Build Date: 11-07-2013 14:33:00 Topic ID: 4593-460268 [Specified]
Last Closed: 2014-06-28 11:41:48 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Thies Rubarth 2013-07-22 05:33:57 EDT
Title: Update Application Code for Third-party Logging Frameworks

Describe the issue:

The steps described to configure logging in the application without using the logging subsystem are incomplete. There are several modules that have to be excluded as well to make it work. The log4j.xml (or log4j.properties) file is not found if it is simply included in the lib-Directory of the EAR.

Suggestions for improvement:

The complete exclusion list, that worked for me is:

   <module name="org.apache.commons.logging" />
   <module name="org.apache.log4j" />
   <module name="org.jboss.logging" />
   <module name="org.jboss.logging.jul-to-slf4j-stub" />
   <module name="org.jboss.logmanager" />
   <module name="org.jboss.logmanager.log4j" />
   <module name="org.slf4j" />
   <module name="org.slf4j.impl" />

In addition the modules have to be excluded for every sub-deplyoment (EJB-JARs or WARs), too.

The log4j configuration file has to be packaged in a JAR file so that it is found.
Comment 1 sgilda 2014-04-09 09:35:36 EDT
Adding James so he can assist in the details.
Comment 2 James Perkins 2014-04-09 13:32:22 EDT
If you don't want to use the log4j dependency provided by the container, then you only need to exclude the org.apache.log4j module. The mother module exclusions are not required. It is true though that the modules would need to be excluded for each subdeployment.

The only reason you'd have to exclude slf4j, commons-logging or jboss-logmanager is if you used those libraries as well and you wanted to provide them. Otherwise there is no reason to exclude them.

As far as it being packaged in a JAR, that works but it's not required. It will work in the lib directory if you modify the jboss-deployment-structure.xml to include the following
            <module name="org.apache.log4j" />
            <resource-root path="lib" />

That only needs to be on the top-level deployment for an EAR. In a WAR putting the configuration file in the WEB-INF/classes works fine.

All this said in 6.2+ using a log4j properties file and letting the container configure your logging works quite well. There is no real reason to exclude it and use your own log4j unless you have some very specific needs.
Comment 3 James Perkins 2014-04-09 13:38:23 EDT
With regards to some changes that should be noted in the docs for 6.3. There are two new attributes on the logging subsystem that help with excluding the 3rd party logging dependencies from being added to the deployments.

The two new attributes are add-logging-api-dependencies and use-deployment-logging-config.

The use-logging-api-dependencies controls whether or not the container adds implicit logging API dependencies to your deployments. If set to true, the default, all the implicit logging API dependencies are added. If set to false the dependencies are not added to your deployments.

The use-deployment-logging-config controls whether or not your deployment is scanned for per-deployment logging. If set to true, the default, per-deployment logging is enabled. Set to false to disable this feature.

Also the org.jboss.as.logging.per-deployment system property has been deprecated. It's advised to set use-deployment-logging-config to false instead.

The add-logging-api-dependencies also removes the need to include a jboss-deployment-structure.xml to exclude each dependency. Note though that the attribute is global so if only one deployment needs to exclude the logging dependencies a jboss-deployment-structure.xml is still required.

Another option is to use a jboss-deployment-structure.xml to exclude the logging subsystem all together. This would be akin to setting both attributes to false for the deployment.
Comment 4 James Perkins 2014-04-09 13:40:28 EDT
There is some more information about the changes here https://docs.jboss.org/author/display/WFLY8/Logging+Configuration and https://docs.jboss.org/author/display/WFLY8/How+To#HowTo-HowdoIuselog4j.propertiesorlog4j.xmlinsteadofusingtheloggingsubsystemconfiguration%3F. That is for WildFly 8, but the two attributes were ported over to EAP 6.3.
Comment 9 Nikoleta Ziakova 2014-04-28 06:47:19 EDT
Verified with EAP 6.3.0 ER2, revision 6.3.0-8

Note You need to log in before you can comment on or make changes to this bug.