[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Logfile name format in logging

Muruga Raj

12/23/2008 7:11:00 AM

Hi,

I am using the "logging" gem for logging.
I used the "RollingFile" appender to rotate the log files.
When the files are rotated they are saved with the sequential number
extension.
That is like develeopment.1.log, development.2.log etc.

Is there any way to add the timestamp for the rotated log file name such
as development_12232008.log etc?
--
Posted via http://www.ruby-....

3 Answers

Dejan Dimic

12/23/2008 8:28:00 AM

0

On Dec 23, 8:10 am, Muruga Raj <murugara...@amshuhu.com> wrote:
> Hi,
>
> I am using the "logging" gem for logging.
> I used the "RollingFile" appender to rotate the log files.
> When the files are rotated they are saved with the sequential number
> extension.
> That is like develeopment.1.log, development.2.log etc.
>
> Is there any way to add the timestamp for the rotated log file name such
> as development_12232008.log etc?
> --
> Posted viahttp://www.ruby-....

You can write your own Logging::Appenders::RollingFileWithTimeStamp
based od Logging::Appenders::RollingFile.

Tim Pease

12/23/2008 4:04:00 PM

0

On Dec 23, 2008, at 12:10 AM, Muruga Raj wrote:

> Hi,
>
> I am using the "logging" gem for logging.
> I used the "RollingFile" appender to rotate the log files.
> When the files are rotated they are saved with the sequential number
> extension.
> That is like develeopment.1.log, development.2.log etc.
>
> Is there any way to add the timestamp for the rotated log file name
> such
> as development_12232008.log etc?

The logging gem does not support this directly. You will need to
writer your own appender class as Dejan Dimic mentioned in his message.

Take a look at the following sample. It should do what you want, but
it is thoroughly untested.

<http://gist.github.com...

I recommend using a date format such as YYYY/MM/DD. This allows your
log files to be sorted chronologically when you list them either in a
file explorer or from the command line using ls.

Blessings,
TwP

Muruga Raj

12/24/2008 3:40:00 AM

0

Tim Pease wrote:
> On Dec 23, 2008, at 12:10 AM, Muruga Raj wrote:
>
>> as development_12232008.log etc?
> The logging gem does not support this directly. You will need to
> writer your own appender class as Dejan Dimic mentioned in his message.
>
> Take a look at the following sample. It should do what you want, but
> it is thoroughly untested.
>
> <http://gist.github.com...
>
> I recommend using a date format such as YYYY/MM/DD. This allows your
> log files to be sorted chronologically when you list them either in a
> file explorer or from the command line using ls.
>
> Blessings,
> TwP

Thank you so much Tim and Dimic.

I am working to extend the RollingFile Appender for timestamped file
names.
When i finish i will convey you

Thanks once again for your ideas
--
Posted via http://www.ruby-....