Hi,
I noticed some strange behaviour in the FileLogging facility. When I
set up FileLogging as shown in the manual, i.e. like this:
<MLET CODE = "org.jboss.logging.FileLogging" ARCHIVE="jboss.jar"
CODEBASE="../../lib/ext/">
<ARG TYPE="java.lang.String" VALUE="Information,Debug,Warning,Error">
<ARG TYPE="java.lang.String" VALUE="[{2}] {4}">
<ARG TYPE="java.lang.String" VALUE="">
<ARG TYPE="java.lang.String" VALUE="../log/server">
<ARG TYPE="java.lang.Boolean" VALUE="true">
</MLET>
then I get this:
javax.management.MalformedObjectNameException: ObjectName: Invalid (key,value) pair ->
sources=
at javax.management.ObjectName.<init>(ObjectName.java:177)
at org.jboss.logging.FileLogging.getObjectName(FileLogging.java:127)
at org.jboss.util.ServiceMBeanSupport.preRegister(ServiceMBeanSupport.java:159)
at
com.sun.management.jmx.MBeanServerImpl.preRegisterInvoker(MBeanServerImpl.java:2245)
at com.sun.management.jmx.MBeanServerImpl.createMBean(MBeanServerImpl.java:765)
at javax.management.loading.MLet.getMBeansFromURL(MLet.java:540)
at javax.management.loading.MLet.getMBeansFromURL(MLet.java:369)
at org.jboss.Main.<init>(Main.java:119)
at org.jboss.Main$1.run(Main.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.Main.main(Main.java:83)
The relevant part of FileLogging looks like this:
this.name = name == null ? new ObjectName(OBJECT_NAME + (sources == null ? "" :
",sources=" + sources))
: name;
so, the above error happens obviously because the "sources" parameter
was set to the empty string, and the above code only checks for a null
reference. When I change it as follows, it works as intended:
$ cvs diff src/main/org/jboss/logging/FileLogging.java
Index: src/main/org/jboss/logging/FileLogging.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/logging/FileLogging.java,v
retrieving revision 1.9
diff -r1.9 FileLogging.java
127c127
< this.name = name == null ? new ObjectName(OBJECT_NAME + (sources == null ? ""
: ",sources=" + sources))
---
> this.name = name == null ? new ObjectName(OBJECT_NAME + ((sources == null ||
>sources.equals(""))? "" : ",sources=" + sources))
$
Excuse me if the jboss-dev list would have been a better place for
this. I didn't want to subscribe to yet another mailing list just to
write one article (my mail account ist quite restricted in size here).
Olaf
--
Olaf Klischat | Fraunhofer ISST
Oberfeldstrasse 132 | Mollstrasse 1
12683 Berlin, Germany | 10178 Berlin, Germany
phone: +49 30 54986231 | mail: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]