Feature Requests item #426946, was updated on 2001-05-24 07:38
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376688&aid=426946&group_id=22866

Category: None
Group: None
Status: Open
Priority: 5
Submitted By: Paul Austin (p_d_austin)
Assigned to: Nobody/Anonymous (nobody)
Summary: log4j DOMConfigurator

Initial Comment:
The current Log4jService looks for a file called 
log4jproperties or the user can specify a file name to 
load. What would be useful is if the file ends 
with .xml it should use the DOMConfigurator to load 
the file.

The following import would be added.

import org.apache.log4j.xml.DOMConfigurator;

The start() method would change as below.

    public void start() throws Exception
    {
        boolean isXml = (configurationPath.indexOf
(".xml") != -1);
        
        // Make sure the config file can be found
        ClassLoader loader = Thread.currentThread
().getContextClassLoader();
        URL url = loader.getResource
(configurationPath);
        if( url == null )
            throw new FileNotFoundException("Failed to 
find logj4 props: "+configurationPath);
        if( refreshFlag )
        {
            // configurationPath is a file path
            String path = url.getFile();
            if (isXml) {
                DOMConfigurator.configureAndWatch
(path, 1000*refreshPeriod);
            } else {
                PropertyConfigurator.configureAndWatch
(path, 1000*refreshPeriod);
            }
        }
        else
        {
            if (isXml) {
                DOMConfigurator.configure(url);
            } else {
                PropertyConfigurator.configure(url);
            }
        }
        this.category = Category.getRoot();
        category.info("Started Log4jService, 
config="+url);
    }


Cheers,
Paul


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376688&aid=426946&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to