Hi,

I am quite new to log4j and made some simple steps to understand log4j.

I've noticed that log4j does *not* reconfigure on config file change unless I tell him programmatically with PropertyConfigurator#configureAndWatch. Well, this situation is quite unpleasant since I wanted to configure my l4j env completely with properties/xml files and *not* programmatically.

I've searched the list but couldn't gain any good information to use.

Is there some possibility to tell log4j in the props file something like 'log4j.watch=true'?

Another issue is that I want to reuse the same props file on different webapps and there is no built-in possibility to tell within the context:

log4j.appender.mystuff.File=${catalina.home}/logs/${contextName}.log

???

Since I didn't find any built-in solution to the problems above, I have to create a contextlistener which configures those parts at startup.

my ServletContextListener would look like:

        public void contextInitialized(ServletContextEvent sce) {
                
// I really dislike this option and would really like rely on the automatic property discovery String path = sce.getServletContext().getRealPath("/WEB-INF/classes/log4j.properties");
                PropertyConfigurator.configureAndWatch(path);
                
                String contextName = 
sce.getServletContext().getServletContextName();
//and now?? how do I tell, for instance the appender "mystuff" to use #setFile("${catalina.home}/logs/"+contextName+".log")
                //there is no way to retreive a declared fileappender by name, 
is there?

        }

System.setProperty("contextName",contextName);

Can't be set obviously.

Any help will be appreciated!

Mike
--
<NO> OOXML - Say NO To Microsoft Office broken standard
http://www.noooxml.org

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

Reply via email to