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 da...@grupodelaware.com on 2004/01/12 16:12:12 UTC

Shutting down specific instance of log file

Hi everyone.

I'm currently facing a problem where I have two instances of log files, one
running internally using Turbine, and the other for a process withing my
application which runs for about an hour every day.  For this separate
process I have my own log file, and I wish to shut it down after it is
finished.  The properties file for that log file looks like this:

log4j.rootLogger=DEBUG, default

log4j.appender.default=org.apache.log4j.RollingFileAppender
log4j.appender.default.layout=org.apache.log4j.PatternLayout
log4j.appender.default.File=${file.name}.log
log4j.appender.default.datePattern='.'yyyy-MM-dd
log4j.appender.default.layout.ConversionPattern=[%d] [%t] %-5p %M.%L - %m%n

The problem is in my code, the only way I have found to terminate this log
file is by calling LogManager.shutdown(); which unfortunately closses all
log files down (including the Turbine log file) which is not the intended
purpose.  Can anyone offer any suggestions for shutting down only one
specific log file??

Thanks,

Damian.




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


Re: Shutting down specific instance of log file

Posted by Roth Marcel <ma...@softlab.ch>.
Hi,

I'm using a code like this for closing my ConsoleAppender and then add a 
RollingFileAppender instead ...
Marcel

            if (Log.isAttached(myCAppender)) {
                    Log.removeAppender(myCAppender);
            }

Zitiere dalonsoh@grupodelaware.com:

> Hi everyone.
> 
> I'm currently facing a problem where I have two instances of log files,
> one
> running internally using Turbine, and the other for a process withing
> my
> application which runs for about an hour every day.  For this separate
> process I have my own log file, and I wish to shut it down after it is
> finished.  The properties file for that log file looks like this:
> 
> log4j.rootLogger=DEBUG, default
> 
> log4j.appender.default=org.apache.log4j.RollingFileAppender
> log4j.appender.default.layout=org.apache.log4j.PatternLayout
> log4j.appender.default.File=${file.name}.log
> log4j.appender.default.datePattern='.'yyyy-MM-dd
> log4j.appender.default.layout.ConversionPattern=[%d] [%t] %-5p %M.%L -
> %m%n
> 
> The problem is in my code, the only way I have found to terminate this
> log
> file is by calling LogManager.shutdown(); which unfortunately closses
> all
> log files down (including the Turbine log file) which is not the
> intended
> purpose.  Can anyone offer any suggestions for shutting down only one
> specific log file??
> 
> Thanks,
> 
> Damian.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 



Marcel Roth
Technology Consultant
Enterprise CRM
_______________________________
Softlab AG
Kanalstrasse 31
CH-8152 Glattbrugg
Switzerland
Telefon    +41 1 809 41 57
Telefax    +41 1 809 41 42
Mobile 	   +41 76 420 02 07
E-Mail 	   mailto:marcel.roth@softlab.ch
Homepage:  http://www.softlab.ch
_______________________________

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