You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2007/07/11 12:18:15 UTC

DO NOT REPLY [Bug 42855] New: - Problems after exception in LogManager clinit

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42855>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42855

           Summary: Problems after exception in LogManager clinit
           Product: Log4j
           Version: 1.2
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: malcolm.cleaton@ubs.com


Hi. My team ship a product which uses custom log4j appenders for integration
with a messaging system.

Usually everything is very nice. However, we recently hit a nasty problem where
one of our customers was using commons-logging on top of log4j. A
NoClassDefFoundError was raised, as runtime dependencies of our custom appender
were missing, and this error propagated through the static clinit in LogManager.
Usually this wouldn't have been so bad, as the exception would have been
reported and easy to debug from, but with commons-logging loading log4j, the
exception is swallowed and some other logging system is swapped in.

Later on, when our code tries to use log4j directly, things are broken
internally. LogManager failed to load, so future attempts to reference loggers
die with "java.lang.NoClassDefFoundError at
org.apache.log4j.Logger.getLogger(Logger.java:117)". When this is the only error
you're seeing, it's quite hard to debug what's going on.

I suggest that LogManager should do more handling of errors; perhaps it could
dump the stack trace to stderr before propagating an unhandled exception or
error out of the static initialization block?

I've also suggested that commons-logging could behave better here than silently
swallowing the NoClassDefFoundError, in
https://issues.apache.org/jira/browse/LOGGING-114, but it's uphill. I'm very
much hoping one project or the other will agree to a tweak, so that nobody else
has to debug from these very confusing messages!

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org