Forum: Ruby Logfile name format in logging

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1096faf8225c7d50fcae3db9f49810d4?d=identicon&s=25 Muruga Raj (murugaraj_82)
on 2008-12-23 08:19
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?
04952a6ee948f345e9c3727850d09a1b?d=identicon&s=25 Dejan Dimic (Guest)
on 2008-12-23 09:30
(Received via mailing list)
On Dec 23, 8:10 am, Muruga Raj <murugara...@amshuhu.com> wrote:
> --
> Posted viahttp://www.ruby-forum.com/.

You can write your own Logging::Appenders::RollingFileWithTimeStamp
based od Logging::Appenders::RollingFile.
4d5b5dd4e263d780a5dfe7ac8b8ac98c?d=identicon&s=25 Tim Pease (Guest)
on 2008-12-23 17:13
(Received via mailing list)
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/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
1096faf8225c7d50fcae3db9f49810d4?d=identicon&s=25 Muruga Raj (murugaraj_82)
on 2008-12-24 04:49
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/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
This topic is locked and can not be replied to.