Logfile name format in logging


#1

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?


#2

On Dec 23, 8:10 am, Muruga R. removed_email_address@domain.invalid wrote:


Posted viahttp://www.ruby-forum.com/.

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


#3

Tim P. wrote:

On Dec 23, 2008, at 12:10 AM, Muruga R. 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 D. 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/39362

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


#4

On Dec 23, 2008, at 12:10 AM, Muruga R. 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 D. 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/39362

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