Kevin,

Sounds logical. I just couldn't believe I was the first to suggest
a more generic approach to file rolling. ;-)

--

Thomas


| -----Original Message-----
| From: Kevin Steppe [mailto:[EMAIL PROTECTED]]
| Sent: 22 April 2002 17:06
| To: Log4J Users List
| Subject: Re: how to dynamically change the logfile at run time
|
|
| Thomas,
|     That will be the design idea for improvements in the 1.3
| version I'll be
| working on.  The idea is to separate the "When and how do I
| change files?" from
| the implementation details of putting logging events into a files.
|
| Kevin
|
|
| Thomas Tuft Muller wrote:
|
| > Yeah, but the initiator wanted to *change* the file at runtime, not
| > *set* it just before configuration.
| >
| > This functionality is basically a RollingFileAppender rolling the file
| > on a different criteria than file size (or time).
| >
| > The class org.apache.log4j.varia.ExternallyRolledFileAppender could
| > maybe be used as a starting point, since this almost provides the
| > functionality needed: an externally triggered rolling.
| >
| > Without any profound knowledge of the internal design, I guess this
| > maybe calls for a generic RollingFileAppender which handles the rolling
| > specific behaviour, and subclasses that implements the triggering of it.
| >
| > --
| >
| > Thomas
| >
| > | -----Original Message-----
| > | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
| > | Sent: 22 April 2002 14:09
| > | To: [EMAIL PROTECTED]
| > | Subject: RE: how to dynamically change the logfile at run time
| > |
| > |
| > | One way that i use to specify the filename dynamically is setting
| > | this in the properties file:
| > |
| > | # Appender definition
| > | log4j.appender.appender_name = org.apache.log4j.FileAppender
| > | log4j.appender.appender_name.File = ${file.name}
| > | log4j.appender.appender_name.ImmediateFlush = true
| > | log4j.appender.appender_name.layout = org.apache.log4j.PatternLayout
| > | log4j.appender.appender_name.layout.ConversionPattern =
| > | %d{HH:mm:ss,SSS} [%c] [%p] (%F:%L) - %m%n
| > |
| > | Then in the code, before executing the
| > | PropertyConfigurator.configure write this line:
| > |
| > |       System.setProperty("file.name", "C:\\apps\\logs\\file1.log");
| > |
| > | Hope this helps
| > |
| > |
| > |
| > | -----Original Message-----
| > | From: ext Thomas Tuft Muller [mailto:[EMAIL PROTECTED]]
| > | Sent: 22. April 2002 14:56
| > | To: Log4J Users List
| > | Subject: RE: how to dynamically change the logfile at run time
| > |
| > |
| > | Yeah, that's why I suggested that you remove the "old" appender
| > | with the unwanted file-name.
| > |
| > | If this suggestion doesn't suffice, write your own Appender satisfying
| > | your particular needs.
| > |
| > | --
| > |
| > | Thomas
| > |
| > |
| > | | -----Original Message-----
| > | | From: Marta Maldonado [mailto:[EMAIL PROTECTED]]
| > | | Sent: 22 April 2002 13:47
| > | | To: Log4J Users List
| > | | Subject: Re: how to dynamically change the logfile at run time
| > | |
| > | |
| > | | ...I think addAppender method is accumulative...
| > | |
| > | | Thomas Tuft Muller wrote:
| > | |
| > | | > Instead of changing the log file of a specified appender, you can
| > | | > just (programmatically) add a new appender with the new file, and
| > | | > possibly remove the old one.
| > | | >
| > | | > ...
| > | | > Logger logger = Logger.getLogger( "foo.bar" );
| > | | > Appender appender = new FileAppender( new PatternLayout( ... ),
| > | | > "foo-bar.log", false );
| > | | > logger.addAppender( appender );
| > | | > ...
| > | | >
| > | | > Hope this helps.
| > | | >
| > | | > --
| > | | >
| > | | > Thomas
| > | | >
| > | | > | -----Original Message-----
| > | | > | From: Castaway Gladiator [mailto:[EMAIL PROTECTED]]
| > | | > | Sent: 19 April 2002 21:48
| > | | > | To: [EMAIL PROTECTED]
| > | | > | Subject: how to dynamically change the logfile at run time
| > | | > |
| > | | > |
| > | | > | How to dynamically change the logfile at run time for a
| > | given Appender
| > | | > | I want to create a log file with name  based on th einput
| > | | > | parameter passed
| > | | > | at runtime
| > | | > | Thanks
| > | | > | Balaji Venkatesan
| > | | > |
| > | | > |
| _________________________________________________________________
| > | | > | Get your FREE download of MSN Explorer at
| > | | > | http://explorer.msn.com/intl.asp.
| > | | > |
| > | | > |
| > | | > | --
| > | | > | To unsubscribe, e-mail:
| > | | > | <mailto:[EMAIL PROTECTED]>
| > | | > | For additional commands, e-mail:
| > | | > | <mailto:[EMAIL PROTECTED]>
| > | | > |
| > | | > |
| > | | >
| > | | >
| > | |
| > |
| *************************************************************************
| > | | > Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights
| > | | reserved.
| > | | > The information supplied in this email should be treated in
| > | confidence.
| > | | > No liability whatsoever is accepted for any loss or damage
| > | | > suffered as a result of accessing this message or any attachments.
| > | | >
| > | | >
| > |
| ________________________________________________________________________
| > | | > This email has been scanned for all viruses by the
| MessageLabs SkyScan
| > | | > service. For more information on a proactive anti-virus
| > | service working
| > | | > around the clock, around the globe, visit
http://www.messagelabs.com
> | | >
> | ________________________________________________________________________
> | | >
> | | > --
> | | > To unsubscribe, e-mail:
> | <mailto:[EMAIL PROTECTED]>
> | > For additional commands, e-mail:
> | <mailto:[EMAIL PROTECTED]>
> |
> |
> |
> |
> |
*************************************************************************
> | Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights
reserved.
> | The information supplied in this email should be treated in confidence.
> | No liability whatsoever is accepted for any loss or damage
> | suffered as a result of accessing this message or any attachments.
> |
> | ________________________________________________________________________
> | This email has been scanned for all viruses by the MessageLabs SkyScan
> | service. For more information on a proactive anti-virus service working
> | around the clock, around the globe, visit http://www.messagelabs.com
> | ________________________________________________________________________
> |
> | --
> | To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> *************************************************************************
> Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved.
> The information supplied in this email should be treated in confidence.
> No liability whatsoever is accepted for any loss or damage
> suffered as a result of accessing this message or any attachments.
>
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service. For more information on a proactive anti-virus service working
> around the clock, around the globe, visit http://www.messagelabs.com
> ________________________________________________________________________
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




*************************************************************************
Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved. 
The information supplied in this email should be treated in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to