User: starksm
Date: 01/06/15 11:00:17
Modified: src/main/org/jboss/logging Log4jService.java
Log:
Check the configuration file for a .xml extension and if it exists, use
the DOMConfigurator rather than PropertyConfigurator
Revision Changes Path
1.7 +12 -3 jboss/src/main/org/jboss/logging/Log4jService.java
Index: Log4jService.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/Log4jService.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Log4jService.java 2001/05/04 06:08:08 1.6
+++ Log4jService.java 2001/06/15 18:00:17 1.7
@@ -21,6 +21,7 @@
import org.apache.log4j.Category;
import org.apache.log4j.NDC;
import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.xml.DOMConfigurator;
/** This is a JMX MBean that provides three features:
1., It initalizes the log4j framework from the log4j properties format file
@@ -38,7 +39,7 @@
@author <a href="mailto:[EMAIL PROTECTED]">Fulco Muriglio</a>
@author [EMAIL PROTECTED]
@author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
-@version $Revision: 1.6 $
+@version $Revision: 1.7 $
*/
public class Log4jService implements Log4jServiceMBean, NotificationListener,
MBeanRegistration
@@ -104,6 +105,8 @@
*/
public void start() throws Exception
{
+ // See if this is an xml configuration file
+ boolean isXML = configurationPath.endsWith(".xml");
// Make sure the config file can be found
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL url = loader.getResource(configurationPath);
@@ -113,11 +116,17 @@
{
// configurationPath is a file path
String path = url.getFile();
- PropertyConfigurator.configureAndWatch(path, 1000*refreshPeriod);
+ if( isXML )
+ DOMConfigurator.configureAndWatch(path, 1000*refreshPeriod);
+ else
+ PropertyConfigurator.configureAndWatch(path, 1000*refreshPeriod);
}
else
{
- PropertyConfigurator.configure(url);
+ if( isXML )
+ DOMConfigurator.configure(url);
+ else
+ PropertyConfigurator.configure(url);
}
this.category = Category.getRoot();
category.info("Started Log4jService, config="+url);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development