[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-581) Seam logging does not report correct line number/class name/method name under Log4J or JDK1.4 logging

Mike Quilleash (JIRA) jira-events at jboss.com
Tue Dec 12 04:12:38 EST 2006


     [ http://jira.jboss.com/jira/browse/JBSEAM-581?page=all ]

Mike Quilleash updated JBSEAM-581:
----------------------------------

    Attachment: Log4JLogger.java
                LogImpl.java
                SeamLogFactory.java

First stab at a solution.  This uses a completely different LogFactory for creating all Seam logs.  It extends the commons logging implementation and subsitutes in a different Log4J implementation (single line change but an extends is not possible so cut-n-paste).  It modifies the FQCN variable to be LogImpl of Seam instead of Log4Logger so the Log4J library calculates the line number/class name/method name of the calling code correctly.

This does not fix JDK1.4 logging which will still report the class name and method name incorrectly.  This would require a small modification to the SeamLogFactory to trap the JDK1.4 case and create a different JDK14Logger implementation that passes in the correct class and method name.

This also has unknown Classloading/memory leak potential when running inside a web container and redeploy is used.  commons-logging has issues with caching classloader references and therefore holding all it's classes.  A possible solution would be to call SeamLogFactory.release(All) in the SeamContextListener.contextDestroyed().  This would ensure the LogFactory released all it's class/class loader caches.

A better long term solution would be to submit a CR to commons-logging to allow pluggable manipulation of the log message using a callback which would allow Seam to do it's EL parsing on the string while preserving the current line number/class name/method name detection mechanics.

> Seam logging does not report correct line number/class name/method name under Log4J or JDK1.4 logging
> -----------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-581
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-581
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.0.CR2
>         Environment: Java 1.5.0_06
> Windows XP Pro
> Tomcat 6.0.0
>            Reporter: Mike Quilleash
>         Attachments: Log4JLogger.java, LogImpl.java, SeamLogFactory.java
>
>
> Seam uses a wrapper around commons logging to allow it to evaluate EL expressions as part of the log string.  However this adds an extra level to the call stack which the commons logging library is unaware of so the reporting of line numbers/class name/method name in log output always reports the line number in the Seam logging implementation rather than the calling code above it.
> This affects Log4J (line numbers/class name/method name) and JDK1.4 logging (class name/method name).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list