File Rotation

1

1dg618

Is there a way to rotate the log files each time the process runs
using the existing functionality via the configuration? If the process
has issues, the most recent log file logged the information. I can't
find a way, but, I assume, others have found a way?
 
1

1dg618

Newsgroups these days are infested with posts which contain
randomly-chosen words which mean nothing.  I thought this was one of
them initially but maybe it isn't.

Mr/Ms 1dg618 (May I call you "One d" for short?) for us to help you're
going to need to be much more precise about what you're trying to do and
what's not happening the way you want it to.

For a start, Perl programs (this is a Perl group) don't write log files
unless you tell them to.  Once they're written they're the property of
the operating system, which may provide log-rotation functionality (UNIX
does, for example).

And when you say "the existing functionality via the configuration",
which functionality and which configuration?  (And of what?)

CPAN contains many modules which have "log file" in their descriptive
text.  It's possible that one of those may do exactly what you want, but
until you make clear what it is that you want we can't help you further.

Sorry, using Log4Perl. I'll look for a Log4Perl user group.
 
1

1dg618

Newsgroups these days are infested with posts which contain
randomly-chosen words which mean nothing.  I thought this was one of
them initially but maybe it isn't.

Mr/Ms 1dg618 (May I call you "One d" for short?) for us to help you're
going to need to be much more precise about what you're trying to do and
what's not happening the way you want it to.

For a start, Perl programs (this is a Perl group) don't write log files
unless you tell them to.  Once they're written they're the property of
the operating system, which may provide log-rotation functionality (UNIX
does, for example).

And when you say "the existing functionality via the configuration",
which functionality and which configuration?  (And of what?)

CPAN contains many modules which have "log file" in their descriptive
text.  It's possible that one of those may do exactly what you want, but
until you make clear what it is that you want we can't help you further.

I'm using Log4Perl. If I wrote my own with Perl, I wouldn't have to
ask the question. Right?
 
1

1dg618

Sorry, using Log4Perl. I'll look for a Log4Perl user group.- Hide quoted text -

- Show quoted text -

My Log4Perl configuration rotates the log files daily. Using the
DatePattern I can get that down to minutes. How do you get the log
files to rotate everytime the process runs? Is there a way to do it in
Log4Perl?

my $log_conf = q/
log4perl.category = INFO, Logfile
log4perl.appender.Logfile=Log::Dispatch::FileRotate
log4perl.appender.Logfile.max=10
log4perl.appender.Logfile.mode=append
log4perl.appender.Logfile.filename=sub { return get_log_fn(); }
log4perl.appender.Logfile.DatePattern=yyyy-MM-dd
log4perl.appender.Logfile.TZ=CST

log4perl.appender.Logfile.layout=Log::Log4perl::Layout::patternLayout
log4perl.appender.Logfile.layout.ConversionPattern=%d %M %L> %p -
%m%n
/;

Otherwise, I'll have to use Herny's suggestion and write my own code
to do it.
 
J

Jürgen Exner

1dg618 said:
Is there a way to rotate the log files

What log files?
each time the process runs

What process runs? fork()ed by Perl? Your program itself?
using the existing functionality via the configuration?

What existing functionality of what and what configuration?
If the process
has issues, the most recent log file logged the information. I can't
find a way, but, I assume, others have found a way?

Mysterious your words are....

jue
 
1

1dg618

What log files?


What process runs? fork()ed by Perl? Your program itself?


What existing functionality of what and what configuration?


Mysterious your words are....

jue

Sorry, I was talking about Log4Perl. Here's my configuration:

my $log_conf = q/
log4perl.category = INFO, Logfile
log4perl.appender.Logfile=Log::Dispatch::FileRotate
log4perl.appender.Logfile.max=10
log4perl.appender.Logfile.mode=append
log4perl.appender.Logfile.filename=sub { return get_log_fn(); }
log4perl.appender.Logfile.DatePattern=yyyy-MM-dd
log4perl.appender.Logfile.TZ=CST

log4perl.appender.Logfile.layout=Log::Log4perl::Layout::patternLayout
log4perl.appender.Logfile.layout.ConversionPattern=%d %M %L> %p -
%m%n
/;

Using the DatePattern, I can rotate the logs every hour, but I'd like
to rotate the log files each time the process I created runs. I don't
know if there is a way using Log4Perl?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top