Hi
I have a J2EE  application and we use log4j for
logging. We used log4j.properties files and packaged
it in a war under WEB-INF/classes. It all worked fine
under Weblogic, Tomcat etc.
But now when we migrated to  JBoss it has its own
log4j.xml file. So our application grabbed it as the
first one and did not load our log4j.properties.
I got around it by using
-Dlog4j.configuration=log4j.properties in the startup
command.
But I really dont like this soultion because this
system property will now be applicabe to all
applications on JBOSS and thats not a good thing.
Now we are plannning to use our own name like
log4j-productName.properties file and make use of
PropertyConfigurator.
>From the startup command we will pass the directory
name containg config files : example
-Dproduct.config=c:/config  . In this we will have the
log4j-product.properties file. 
And we will load it and use PropertyConfigurator.
But this is not working exactly. When we start the
server it gives all sort of exception.
where should I exactly use the PropertyConfigurator ?
In a static block ? This is what I have

      String path = System.getProperty("config.home");
        Properties p = new Properties();
        try {
            FileInputStream fis = new
FileInputStream(path + "/log4j-product.properties");
             p.load(fis);
        } catch (FileNotFoundException e) {
            e.printStackTrace();  //To change body of
catch statement use Options | File Templates.
        }  catch(java.io.IOException ie) {
            ie.printStackTrace();
        }

        PropertyConfigurator.configure(p);


I get this error:
04-06-11 15:32:53,924 INFO  [STDOUT] log4j:ERROR
"org.jboss.logging.util.OnlyOnceErrorHandler" was
loaded by
[EMAIL PROTECTED]
2004-06-11 15:32:53,924 DEBUG
[org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL
with url null
2004-06-11 15:32:53,924 DEBUG
[org.jboss.mx.loading.UnifiedClassLoader]
setRepository,
[EMAIL PROTECTED],
[EMAIL PROTECTED]
url=null ,addedOrder=0}
2004-06-11 15:32:53,924 DEBUG
[org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL
with url null
2004-06-11 15:32:53,924 DEBUG
[org.jboss.mx.loading.UnifiedClassLoader]
setRepository, r=org


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to