[Bug 45] New: ClassCastException with log4j-bridge

http://bugzilla.qos.ch/show_bug.cgi?id=45 Summary: ClassCastException with log4j-bridge Product: logback-general Version: unspecified Platform: PC OS/Version: Windows Status: NEW Severity: blocker Priority: P1 Component: build-structure AssignedTo: logback-dev@qos.ch ReportedBy: mreynolds@anystream.com I am using log4j-bridge version 0.9. Many of the methods in org.apache.log4j.Category cast "Object message" to String resulting in a ClassCastException if the logging call is passing an object other than a String. Instead of casting, you should probably call message.toString(), which, in the absence of RenderSupport, is what log4j would do anyway. Thanks for logback! -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=45 ------- Comment #1 from mreynolds@anystream.com 2007-02-15 02:24 ------- I ended up casting for the null case and using .toString() for the not null case: public void trace(Object message) { if (message == null) { lbLogger.debug(TRACE_MARKER, (String) message); } else { lbLogger.debug(TRACE_MARKER, message.toString()); } } -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=45 noreply.sebastien@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from noreply.sebastien@qos.ch 2007-02-15 15:44 ------- Hello Mark, Thanks for the report :) I've modified the Category class, it should now work as expected. You can check out the latest repository version if you wish to benefit from the changes immediately. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
participants (1)
-
bugzilla-daemon@pixie.qos.ch