proposed update of log4j stuff....

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi everyone,

I have made some changes to the way the log4j stuff works in Barracuda in 
my local CVS repository.  I want to commit the stuff, but it requires some 
changes that might kick people in the butt for a bit if they don't realize 
the change happened.

Basically I did the following.

1.  Got rid of Log4jCRS and replaced it with 
ContextClassLoaderSelector.  The reason for this is that the Log4j project 
has accepted a version of my repository selector in the next version of 
Log4j (1.3).  However, after review by those smarter than myself, the class 
was significantly simplified and the name was changed.  I want to keep the 
same naming scheme so that the only thing that changes when Log4j-1.3 comes 
out is that we change the package reference in the init code to point to 
the log4j package instead of Barracuda's package.

2.  Moved the init stuff into the contextInitialized() method of the 
Log4jApplicationWatch servlet context listener.  This makes the logging 
setup more bulletproof.  It guarantees that logging will be configured 
before any code in the app uses log4j where the servlet init does 
not.  Also, I was able to remove the ugly syncronization code since the 
code is guaranteed to be called once, and only once in the entire 
application lifecycle.  I actually did keep Log4jInit around, but it should 
only be used in servlet-2.2 environments.

3.  Given #2, I had to move the logging config stuff in the web.xml to 
<context-param>'s rather than servlet <init-param>'s because <listener> 
elements don't provide for listener-specific init parameters.


Changing this means that people need to be diligent about not using both 
Log4jApplicationWatch *and* Log4jInit at the same time.  Like I said, 
Log4jInit should be removed entirely except for those running under 
servlet-2.2 engines.  Log4jApplicationWatch is all you need for servlet-2.3 
engines.  Also, if you update barracuda-webapp.jar, then you also need to 
update barracuda-log4j.jar because of the change of the selector name to 
ContextClassLoaderSelector.

I'm supplying my changes in a zip file (attached).  Let me know what you 
think.  if this change seems ok to make, I'll commit it sometime 
tomorrow.  See Usage.txt inside the zip file for further instructions.

thanks,

Jake
Log4j_servlet_initialization.zip (application/zip, 20.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.