tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Re[2]: Servlets & JSPs log to different files
Date Mon, 04 Aug 2003 13:22:35 GMT

I would point out a couple of things, since you posted this code as an
example, but they are subjective.

>I have a servlet that is loaded at the time tomcat starts.

The container is free to destroy and reload this servlet as it deems
necessary.  Accordingly, use a ServletContextListener instead.

>   DOMConfigurator domConfig;

Should be private?  And inside the method rather than a servlet instance

>then in the class (bean) that has no idea about the context i have the
>   protected org.apache.log4j.Logger logWriter =
>   org.apache.log4j.Logger.getLogger("nameoffiletoappearinlog");

Why is this protected?  You almost always want loggers to be private
(static, and final).

Yoav Shapira

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

View raw message