logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Cruver <daniel.cru...@cubrc.org>
Subject Re: log4j 1x usage in jsp.
Date Wed, 30 Apr 2014 01:43:23 GMT
Did you follow the directions Tomcat provides for using Log4J 1.x? It provides directions specifically
for replacing all logging. We have done this on our project.  One thing is that if you hot
deploy and undeploy to a tomcat it might leave some things in memory. In production instances
hot deployment might not be best. If you restart the Tomcat Webserver and not just the web
applications I believe nothing should be left behind.

On Apr 29, 2014 9:06 PM, Remko Popma <remko.popma@gmail.com> wrote:
The manual page you quote is specifically for log4j-2.0.
Log4j-1.2 works differently and I don't think you can apply the 2.0 manual
to log4j-1.2.
If you cannot move to 2.0, I suggest simply using log4j-1.2 with your
application and take it from there. Don't worry about the 2.0 manual in
that case.


On Wed, Apr 30, 2014 at 7:51 AM, Gordon <knowledgebaseglinux@gmail.com>wrote:

> Hi,
> I understand the current version of log4j is 2.x, but our company using
> log4j 1.x and so my question is specific to version 1.x:
> It's said here
> http://logging.apache.org/log4j/2.x/manual/webapp.html
> that
> "You must take particular care when using Log4j or any other logging
> framework within a Java EE web application. It's important for logging
> resources to be properly cleaned up (database connections closed, files
> closed, etc.) when the container shuts down or the web application is
> undeployed. Because of the nature of class loaders within web applications,
> Log4j resources cannot be cleaned up through normal means. Log4j must be
> "started" when the web application deploys and "shut down" when the web
> application undeploys. How this works varies depending on whether your
> application is a Servlet 3.0 or
> newer<http://logging.apache.org/log4j/2.x/manual/webapp.html#Servlet-3.0
> >or
> Servlet
> 2.5 <http://logging.apache.org/log4j/2.x/manual/webapp.html#Servlet-2.5
> >web
> application."
> Questions:
> 1) How do I start Log4j?  Did I miss something?  Currently I'm using log
> for 4 in my jsp / java as follows:
> import or.apache.log4j.Logger;
> Logger log = Logger.getLogger("LoggerName");
> log.error("msg");
> 2) How do I "shut down" Log4j per above?  If there is a service call that I
> have to make before and after Tomcat gets started, I am not aware.
> 3) What if I don't start / shudown Log4J correctly, what files / resources
> will remain and where is the resource located and how do I clean up the
> resource?
> 4) Since can redeploy my web app, this means I can go in and delete the
> whole tomcat temp directory AND whatever resources (files) that log4j
> uses... so what's the concern?
> Thank you,
> Gordon
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message