logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael <sg...@gmx.net>
Subject Reasonable approach to configure log4j in a web app environment
Date Fri, 16 Nov 2007 23:33:19 GMT

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 

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:



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 = 
		String contextName = sce.getServletContext().getServletContextName();
		//and now?? how do I tell, for instance the appender "mystuff" to use 
		//there is no way to retreive a declared fileappender by name, is there?



Can't be set obviously.

Any help will be appreciated!

<NO> OOXML - Say NO To Microsoft Office broken standard

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message