Hi, 
Can someone provide advice or best practice for this problem? We use the Spring 
framework (v1.0) and have the following setup in our web.xml to initiate 
logging 

<context-param> 
<param-name>log4jConfigLocation</param-name> 
<param-value>/WEB-INF/conf/log4j.properties</param-value> 
</context-param> 

This is fine and has been working for us. However, now we are moving into 
managed regions, which equate to a test, qa and prod regions. The problem now 
becomes a question of managing the logging level depending on what region we 
are in. 

We do not have the ability to change the application property files once it 
moves into Test and all files from Test get moved up to QA. All files from QA 
eventually move up to Prod. So, as you can see, if we turn on logging in Test, 
then that logging will be on in Prod, which we do not want. 

We know what region we are in because we start the application server up with a 
System property that we can access. This tells us what region we are in. So we 
are thinking we will have 4 versions of the log4j.properties file, with the 
following directory structure 

/WEB-INF/conf/dev/log4j.properties 
/WEB-INF/conf/test/log4j.properties 
/WEB-INF/conf/qa/log4j.properties 
/WEB-INF/conf/prod/log4j.properties 

Is this the correct approach? I presume I will have to customize 
org.springframework.web.util.Log4jConfigServlet. I'm interested in your 
thoughts. 

Thanks. 

Ed 

Reply via email to