You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Antony Paul <an...@hotmail.com> on 2003/12/17 12:23:41 UTC

Tomcat log4j .

Hi all,
    I am using Tomcat 4.1.27 + log4j 1.2.8+Win2k sp4. I have some problems
with it.
1, Log4j locks the log file so that I  cannot clear the content of the file.
After some time I want to delete old debugging data while development.
Currently I am doing it by shutting down Tomcat. It is time consuming job.
2, After a context reload in Tomcat, if anyting is written to log the editor
dont say that the file is changed.  It is not changing the last modified
date of the log file.
    log4j jar file is in application's  WEB-INF\classes\lib directory.
log4j.properties is in WEB-INF\classes
    No initialisation servlet is there.
    Some questions
1, What is the SSS in the ConversionPattern means ?
2, Is it necessary to initialise log4j through a servlet ?.

rgds
Antony Paul.



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: Tomcat log4j .

Posted by Duncan Smith <ds...@deckertelecom.net>.
> 1, Log4j locks the log file so that I  cannot clear the content of the file.
1. You could use rolling files and delete the old ones, or even better, upgrade
to linux :-)

>2, Is it necessary to initialise log4j through a servlet ?.
No. It can be done in a jsp also, if that is what you mean, ie: put 'Logger
lgErr = Logger.getLogger("ErrLog");' where you have defined ErrLog in your
properties file.

>1, What is the SSS in the ConversionPattern means ?
Don't beleive SSS mean anything - should just print out 'SSS'

-Duncan www.pennymail.com


Antony Paul wrote:

> Hi all,
>     I am using Tomcat 4.1.27 + log4j 1.2.8+Win2k sp4. I have some problems
> with it.
> 1, Log4j locks the log file so that I  cannot clear the content of the file.
> After some time I want to delete old debugging data while development.
> Currently I am doing it by shutting down Tomcat. It is time consuming job.
> 2, After a context reload in Tomcat, if anyting is written to log the editor
> dont say that the file is changed.  It is not changing the last modified
> date of the log file.
>     log4j jar file is in application's  WEB-INF\classes\lib directory.
> log4j.properties is in WEB-INF\classes
>     No initialisation servlet is there.
>     Some questions
> 1, What is the SSS in the ConversionPattern means ?
> 2, Is it necessary to initialise log4j through a servlet ?.
>
> rgds
> Antony Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: Tomcat log4j .

Posted by Jacob Kjome <ho...@visi.com>.
You need to do a LogManager.shutdown() upon application shutdown.  That will 
solve problems with Log4j keeping handles on files.  Use a Servlet Context 
Listener for this.

Jake

Quoting Antony Paul <an...@hotmail.com>:

> Hi all,
>     I am using Tomcat 4.1.27 + log4j 1.2.8+Win2k sp4. I have some problems
> with it.
> 1, Log4j locks the log file so that I  cannot clear the content of the file.
> After some time I want to delete old debugging data while development.
> Currently I am doing it by shutting down Tomcat. It is time consuming job.
> 2, After a context reload in Tomcat, if anyting is written to log the editor
> dont say that the file is changed.  It is not changing the last modified
> date of the log file.
>     log4j jar file is in application's  WEB-INF\classes\lib directory.
> log4j.properties is in WEB-INF\classes
>     No initialisation servlet is there.
>     Some questions
> 1, What is the SSS in the ConversionPattern means ?
> 2, Is it necessary to initialise log4j through a servlet ?.
> 
> rgds
> Antony Paul.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: Tomcat log4j .

Posted by Ceki Gülcü <ce...@qos.ch>.
At 04:53 PM 12/17/2003 +0530, Antony Paul wrote:
>Hi all,
>     I am using Tomcat 4.1.27 + log4j 1.2.8+Win2k sp4. I have some problems
>with it.
>1, Log4j locks the log file so that I  cannot clear the content of the file.
>After some time I want to delete old debugging data while development.

You can close the appender in question. Calling LogManager.shutdown() will 
close down all appenders.

This code can be added to the 
<../../javax/servlet/ServletContextListener.htm#contextDestroyed(javax.servlet.ServletContextEvent)>contextDestroyed(<../../javax/servlet/ServletContextEvent.htm>ServletContextEvent 
sce) method of a

ServletContextListener.

See for example:

http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg10001.html

Hope this helps,


-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org