logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: log4j 1x usage in jsp.
Date Wed, 30 Apr 2014 01:05:39 GMT
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.

Remko


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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message