Thursday, 15 July 2010

java - Combining Application and Server Level logging with Log4J? -


Is log4J / tomcat working with two different levels of logging possible? Here's my situation: I have some webapps working on the same tomecat server. Some of these applications have their own log4j property (legacy)

Some of the things I want to add include a JDBCPaepad Is a new logger which will work in all these applications (they have to be used together, so we will be very much useful to log in to the DB who choose them. ) I like this I want (and have been tested in one of the local property files for syntax purposes) to the properties file entries are written.

Is it possible to leave this new logger / jdcbender in the server-level log4j.properties file, and then what webapp can access it? For example, if I define logger as 'com.xxx.yyy' then there is a call in the class that grabes the 'com.xxx.yyy' package in any webpap, in which the caller to the logger: < / P>

  Private Static Logger Logger = Logger. GetLogger (MyClass.class);   

Assuming the full declaration is com.xxx.yyy.MyClass.

I have tried to leave the log4j.properties file in $ CATALINA_HOME / lib directory as well as necessary jar files in the same directory (as in the comments below But when I launch my server, it does not seem that one up, though it raises one above my webapp I know that the property file should be on the classpath to move to Class 4, but it A similar-square path style May be required if there is more than one log4j.properties file?

Update: I updated the details of what I did.

I have done some additional research and have learned that if multiple logs 4 j.properties If the files are in space, the system first finds it, such as with Java class / library files.

Finally, the situation I am describing is not possible, the legacy property files of all my web-apps will be ignored for adding one server-level properties. It is still possible to do something like this, but my question was specifically to focus on the log4j.properties file.

No comments:

Post a Comment