Bug 1031221 - [GSS] (6.2.x) LogContext's root logger is not created with a strong child hash map when strong=true
[GSS] (6.2.x) LogContext's root logger is not created with a strong child has...
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Logging (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity unspecified
: CR1
: EAP 6.2.1
Assigned To: James Perkins
Nikoleta Ziakova
Russell Dickenson
:
Depends On: 1052198
Blocks: eap62-cp01-blockers 1031229
  Show dependency treegraph
 
Reported: 2013-11-15 17:58 EST by Kyle Lape
Modified: 2014-02-24 15:15 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In previous versions of JBoss EAP 6, it was found that loggers were sometimes garbage collected early resulting in loss of the loggers and configuration. For example, if a logger had an appender assigned, when the logger is garbage collected a new logger would have been created without the appender attached. In this release of the product, the map of loggers has been changed to use a strong reference rather than a weak reference. This causes the loggers not to get garbage collected and things to work as they should. As a result custom loggers are now honored as expected.
Story Points: ---
Clone Of:
: 1052198 (view as bug list)
Environment:
Last Closed: 2014-02-24 15:15:42 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker LOGMGR-89 Major Resolved LogContext's root logger is not created with a strong child hash map when strong=true 2014-09-05 08:26:33 EDT

  None (edit)
Description Kyle Lape 2013-11-15 17:58:50 EST
When deploying an application in EAP 6 that has a log4j.xml that is deployed by the logging subsystem, it seems that the LogContext is somehow losing a reference to a custom logger, causing all configuration for that logger to be lost.

Given this configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
  <appender name="SAMPLE_APP" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="${jboss.server.log.dir}/SampleApp.log"/>
    <param name="MaxFileSize" value="2MB"/>
    <param name="MaxBackupIndex" value="5"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %c [%t] %-5p - %m%n"/>
    </layout>
  </appender>
  <appender name="SAMPLE_APP_MDB" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="${jboss.server.log.dir}/SampleApp-MDB.log"/>
    <param name="MaxFileSize" value="2MB"/>
    <param name="MaxBackupIndex" value="5"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %c [%t] %-5p - %m%n"/>
    </layout>
  </appender>
  <logger name="com.redhat" additivity="false">
    <level value="TRACE"/>
    <appender-ref ref="SAMPLE_APP_MDB"/>
  </logger>
  <root>
    <priority value="TRACE"/>
    <appender-ref ref="SAMPLE_APP"/>
  </root>
</log4j:configuration>

Every log message ends up in {{SAMPLE_APP}}, regardless of which logger was used.  One finalizer message is also printed to the log:

11:33:00,110 INFO  [stdout] (Finalizer) log4j: Finalizing appender named [SAMPLE_APP_MDB].
Comment 2 JBoss JIRA Server 2013-12-12 13:48:55 EST
James Perkins <jperkins@redhat.com> updated the status of jira LOGMGR-89 to Resolved
Comment 4 Scott Mumford 2014-01-20 22:26:59 EST
Setting flag for inclusion in 6.2.1 release notes.
Comment 5 Scott Mumford 2014-01-23 20:20:12 EST
Set 'Version' field to ensure this ticket appears in documentation effort dashboards.
Comment 6 Scott Mumford 2014-01-27 19:31:34 EST
Hi James.

Can you provide a few details in the Doc Text box above. I took a shot at the 'Consequence' and 'Result' fields, as best I could with what I can grok.

Could you fill in the gaps and straighten out my attempts if I've misunderstood? 

Thanks in advance.
Comment 7 James Perkins 2014-01-27 20:06:36 EST
I updated it the best I could think of. Just as a general note, if it matters, this only affected log4j.
Comment 8 Scott Mumford 2014-01-27 22:54:25 EST
Thanks James. Very much appreciated.

Editing doc text for publication and marking for inclusion in document.
Comment 9 Petr Kremensky 2014-01-31 03:18:26 EST
Verified on EAP 6.2.1 CP CR3

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