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 2008/11/07 01:17:07 UTC

DO NOT REPLY [Bug 46163] New: LoggerDynamicMBean needs to handle a null Appender name

https://issues.apache.org/bugzilla/show_bug.cgi?id=46163

           Summary: LoggerDynamicMBean needs to handle a null Appender name
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: psmith@apache.org


If a plain BasicConfigurator.configure() is called in an application after the
HierarchyMBean is instantiated, then an exception is thrown trying to create an
ObjectName for the appender based on the Appender's name property, which is
initialised to null, and is not allowed.

Instead, the LoggerDynamicMBean class should be defensive when creating a
Appender MBean's by detecting a null/empty string name and at least trying to
use .toString() to construct a logical display name.


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

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


DO NOT REPLY [Bug 46163] LoggerDynamicMBean needs to handle a null Appender name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46163


Curt Arnold <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




--- Comment #3 from Curt Arnold <ca...@apache.org>  2009-01-13 12:30:28 PST ---
Paul, do you want to submit your patch?


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

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


DO NOT REPLY [Bug 46163] LoggerDynamicMBean needs to handle a null Appender name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46163





--- Comment #4 from Paul Smith <ps...@apache.org>  2009-01-13 13:11:33 PST ---
Created an attachment (id=23112)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23112)
Patch that fixes the null appender name

Note: This is a direct diff of my workspace, which also includes a change to
test/build.xml to remove the ErrorHandler test that just doesn't pass on my
computer for some unknown reason (before and after my change).

We've been using this change in production for 2 months now with no problems.


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

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


DO NOT REPLY [Bug 46163] LoggerDynamicMBean needs to handle a null Appender name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46163





--- Comment #1 from Paul Smith <ps...@apache.org>  2008-11-09 15:16:06 PST ---
I have a simple patch for this that I'm just testing, it basically resorts to
defensively using the Appender.toString() in an attempt to get at least a value
for the JMX namespace.  If that fails, well, then you're screwed still.


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

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


DO NOT REPLY [Bug 46163] LoggerDynamicMBean needs to handle a null Appender name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46163


QualityChecker <qu...@free.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qualitychecker@free.fr




--- Comment #2 from QualityChecker <qu...@free.fr>  2008-11-10 03:19:36 PST ---
You'll find here
http://d.cr.free.fr/wswebconsulterfichiers.php?projet=demojava_log4j&mode=res&fichier=org.apache.log4j.jmx.LoggerDynamicMBean.java.res&fichierxsl=
a collection of mistakes and errors. Most are easy to fix.

The entire log4j project is available here :
http://d.cr.free.fr/wswebconsulterfichiers.php?projet=demojava_log4j

If of interest for you, thanks for your (positive..) feedback.
Coming soon : CWE identification of bugs. 


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

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


DO NOT REPLY [Bug 46163] LoggerDynamicMBean needs to handle a null Appender name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46163


Curt Arnold <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #5 from Curt Arnold <ca...@apache.org>  2009-01-14 10:56:17 PST ---
Committed changes in rev 734480.

I did a few things different than Paul's patch.  First, Paul's patch used a
package visible static method to handle the logic to get a name from the
appender.  I moved the function into a common ancestor and made it protected. 
Also, Paul's patch removed use of the layout from the AppenderDynamicMBean
name.  That may be a desirable change, but it wasn't part of this bug report.


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

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