Hi Lukas,
I have tested these context listeners with multiple contexts and they work fine. However, I'd only tested on Tomcat-4.1.xx, not 4.0.xx. Not sure if that makes a difference? Try doing the following...
1. copy log4j-1.2.8.jar (or latest CVS, I guess) to CATALINA_HOME/common/lib (or equivalent in Tomcat-4.0.xx). I would just say shared/lb, but commons-logging seems to barf a bit when that is done. Since Tomcat requires commons-logging, we'll try to play nice by adding the logj4 jar file to common/lib instead of shared/lib where I'd prefer to put custom jars.
2. copy the selector jar file to CATALINA_HOME/shared/lib (or common/lib, but I'd avoid putting many custom jars there)
3. copy the servlet jar to WEB-INF/lib of each webapp you are deploying
4. set up context init parameters in each webapp's web.xml
5. set up env-entry if using the ContextJNDISelector and make sure the env-entry-value is unique for each webapp
If you have problems with that, let me know. It think the issue is that you have been putting the servlet jar in locations other than the WEB-INF/lib of each webapp. I must stress that no matter what, the servlet jar *must* be under WEB-INF/lib no matter what. Once that is done, the log4j jar and the selector jar must be in the same classloader so you can put these two jars in either WEB-INF/lib (somewhat defeats the purpose of this technique, but works...see below....) or a combination of common/lib and shared/lib (see comments above and note that common/lib and shared/lib can see each other so, they are, in effect, the same classloader).
Alternatively, you can always just put all the jars in WEB-INF/lib of each webapp. This provides you with exactly the same configuration options, but is kind of overkill since it creates a new logger repository when the default one would already be unique. But, the configuration options are worth doing this, I think. Your app won't know the difference. Of course, you can forget about the custom selector and listeners and just put log4j.jar in each webapp's WEB-INF/lib and either rely on default configuration or perform your own.
Jake
At 11:18 PM 6/5/2003 +1200, you wrote:
Hello,
I've been using log4jfor a while now in a fairly basic way (using chainsaw) and it has been fantastic.
My problem now is that i have several identical servlets running under tomcat which need to log with different configurations. The problem (a common one i believe) is that only the first context is working properly, the second is either silently ignored (if log4j configures itself using the default /classes/lo4j.properties file) or throws up some strange problems (more on this in a second).
I've found this reference to what i think is the same problem i am having, http://marc.theaimsgroup.com/?l=log4j-user&m=105284179922171&w=2 . I have built and deployed the servlet context listener as described. The context listeners work fine, i can trace them starting up and stopping properly. The first context loads properly and gets configured nicely, however the second context throws a LinkageError error referring to the 'ErrorHandler' class when it tries to configureAndWatch(). The application then shuts down after the LinkageError.
Both contexts will run fine if the other is removed from the server, so i know that both contexts _should_ work. I have tried moving the log4j jar and the context listener jar around into the tomcat lib directory and so on (which hasn't helped) but the target server is an ISP server so i don't really have that option anyhow.
If anyone has any pointers or something that i've missed, it would be a great help.
Log4j: current cvs Tomcat: 4.04
Lukas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.471 / Virus Database: 269 - Release Date: 10/04/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]