Bug 1164063

Summary: Cannot distribute log files when using commons-logging with Logging-Profile
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Eiichi Nagai <enagai>
Component: LoggingAssignee: James Perkins <jperkins>
Status: CLOSED WONTFIX QA Contact: Nikoleta Hlavickova <nziakova>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3.2   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-25 20:02:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eiichi Nagai 2014-11-14 03:05:12 UTC
Created attachment 957401 [details]
reproducer

Description of problem:
Even if Logging-Profile was set in META-INF, log messages are not distributed to each log file when it is using same category name.

Version-Release number of selected component (if applicable):
EAP 6.3.2

How reproducible:
Uploaded sample.zip as reproducer.

Steps to Reproduce:
1. Create new EAP 6 environment.
2. Unzip the sample.zip
  - Replace standalone.xml
  - Deploy TestLogEAR.ear
3. Run EAP 6 server.
4. Access using following URL.
 - http://localhost:8080/TestLogWeb1/TestServlet1
 - http://localhost:8080/TestLogWeb2/TestServlet1
5. Confirm log directory.

Actual results:
test1.log is for TestLogWeb1. test2.log is for TestLogWeb2. However, test1.log is contained from message of TestLogWeb2.

Comment 1 James Perkins 2014-11-25 20:01:02 UTC
The issue is again with jcl-over-slf4j. At this point we might need to fork it.

jcl-over-slf4j uses a static instance and a map to find the logger. Because of this a logger with the same name will return the first logger created no matter which log context it was created on.

For a workaround you should be able exclude org.apache.commons.logging with a jboss-deployment-structure.xml and include a jcl-over-slfj4 library in each WAR deployment.

Note this issue will only appear if loggers with the same name are desired on deployments that use a new log context. For example per-deployment logging that uses commons-logging or logging-profiles that use commons-logging.