Bug 986864 - Migration Guide for Logging in EAP 6.1 is incomplete
Summary: Migration Guide for Logging in EAP 6.1 is incomplete
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: GA
: EAP 6.3.0
Assignee: sgilda
QA Contact: Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-22 09:33 UTC by Thies Rubarth
Modified: 2014-09-29 18:36 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
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 15:41:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Thies Rubarth 2013-07-22 09:33:57 UTC
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:

<exclusions>			
   <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" />
</exclusions>

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 13:35:36 UTC
Adding James so he can assist in the details.

Comment 2 James Perkins 2014-04-09 17:32:22 UTC
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
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.apache.log4j" />
        </exclusions>
        <resources>
            <resource-root path="lib" />
        </resources>
    </deployment>
    ...
</jboss-deployment-structure>

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 17:38:23 UTC
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.

add-logging-api-dependencies
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.

use-deployment-logging-config
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 17:40:28 UTC
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 Hlavickova 2014-04-28 10:47:19 UTC
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.