-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joleen,

On 3/3/16 11:23 PM, Joleen Barker wrote:
> I don't know if I should use a new thread or not but this is a
> continuation of this issue.

Replying to this issue is entirely appropriate.

> I found that even after my changes there was very little being
> written to my new log and there were still many of the product 
> messages being written to the catalina.out. It has now come to my
> attention that the web application contains a log4j.jar file in the
> <WEB-INF>/lib directory and a log4j.properties file in the
> <WEB-INF>/classes directory. This log4j.properties file has a lot
> more items in it and I believe is the reason all the messages from
> the product are still going to the catalina.out log.
> 
> Here I was so proud of myself for getting the logs to go to an
> appender and the log rolling over as expected only to find the
> catalina.out still growing with messages from the application.
> 
> I am unsure how to get these messages to be added to my log file
> that is being used from the log4j.properties file that is in the
> CATALINA_BASE/lib directory.

Where is the class that is producing the log messages? Is it in the
application, or has it been loaded by Tomcat because it's in
CATALINA_BASE/lib, for example?

Can you confirm that the class in question is actually using log4j for
output? There's little that can be done if the class is using
System.out/System.err directly.

Also, does the log4j.properties file in the web application have any
logging going to a ConsoleAppender? That's just the same as printing
to System.out.

> One of the other things I noticed is the vendor has a
> tomcat-juli.jar in the CATALINA_BASE/lib as well as in the
> CATALINA_BASE/bin directory where it should be. Would the one that
> is in the CATALINA_BASE/lib directory be doing anything. Maybe it
> is there in error and not really effecting anything but I don't
> know.

Tomcat will probably pick-up both JAR files, but the second one will
be ignored, since the one in the bin/ directory will be preferred, and
will be in the parent ClassLoader. Are those two .jar files identical?

> I did read in a note on the tomcat web page that gave the
> instructions to use the log4j logging that the steps it had written
> were not needed if you just want to use log4j in your own web
> application - in that case, you would just put log4j and the
> log4j.properties in the WEB-INF/lib and the WEB-INF/classes of your
> web application which it appears the vendor did.

Right: the Tomcat configuration is only required if you want to use
log4j for *Tomcat logging* instead of the standard JULI-based logging.

> So I think I would need to edit their log4j.properties file.

Possibly. As long as there is no use of ConsoleAppender in there (or
catalina.out!), it should be fine.

> Am I on the right track at all here?
> 
> Would it be bad to post their log4j.properties along with mine to
> see how I can edit it to have the info go to the new log?

Just make sure to sanitize the configuration files. Make sure there
aren't SMTP credentials or anything else in there. Also, you probably
want to remove anything vendor-specific, such as thresholds for
certain vendor-specific classes. Those don't really matter and also
you want to protect the guilty. ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlbZzlcACgkQ9CaO5/Lv0PA3QwCfXoVVcy6iq6uVnMDCEyLuOO40
w+8An3qB2/Z4q4R7YWMrRVGIEgHK1ASQ
=q5Ob
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to