File Rotation

Discussion in 'Perl Misc' started by 1dg618, Oct 16, 2011.

  1. 1dg618

    1dg618 Guest

    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?
     
    1dg618, Oct 16, 2011
    #1
    1. Advertising

  2. 1dg618

    1dg618 Guest

    On Oct 16, 11:10 am, Henry Law <> wrote:
    > On 16/10/11 15:43, 1dg618 wrote:
    >
    > > 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?

    >
    > 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.
    >
    > --
    >
    > Henry Law            Manchester, England


    Sorry, using Log4Perl. I'll look for a Log4Perl user group.
     
    1dg618, Oct 16, 2011
    #2
    1. Advertising

  3. 1dg618

    1dg618 Guest

    On Oct 16, 11:10 am, Henry Law <> wrote:
    > On 16/10/11 15:43, 1dg618 wrote:
    >
    > > 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?

    >
    > 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.
    >
    > --
    >
    > Henry Law            Manchester, England


    I'm using Log4Perl. If I wrote my own with Perl, I wouldn't have to
    ask the question. Right?
     
    1dg618, Oct 16, 2011
    #3
  4. 1dg618

    1dg618 Guest

    On Oct 16, 11:26 am, 1dg618 <> wrote:
    > On Oct 16, 11:10 am, Henry Law <> wrote:
    >
    >
    >
    >
    >
    > > On 16/10/11 15:43, 1dg618 wrote:

    >
    > > > 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?

    >
    > > 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..

    >
    > > --

    >
    > > Henry Law            Manchester, England

    >
    > 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.
     
    1dg618, Oct 16, 2011
    #4
  5. 1dg618 <> wrote:
    >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
     
    Jürgen Exner, Oct 16, 2011
    #5
  6. 1dg618

    1dg618 Guest

    On Oct 16, 11:34 am, Jürgen Exner <> wrote:
    > 1dg618 <> wrote:
    > >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


    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?
     
    1dg618, Oct 16, 2011
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will Clark

    360degree rotation in Java2D

    Will Clark, Aug 28, 2003, in forum: Java
    Replies:
    3
    Views:
    3,144
    Knute Johnson
    Sep 4, 2003
  2. Sheena
    Replies:
    1
    Views:
    390
    Harald Hein
    Oct 28, 2003
  3. hilz
    Replies:
    2
    Views:
    1,291
  4. Mark via JavaKB.com

    Java 2D: Image rotation

    Mark via JavaKB.com, Mar 19, 2005, in forum: Java
    Replies:
    0
    Views:
    796
    Mark via JavaKB.com
    Mar 19, 2005
  5. benny

    Seven Day Rotation Script

    benny, Jan 19, 2004, in forum: HTML
    Replies:
    5
    Views:
    513
    benny
    Jan 20, 2004
Loading...

Share This Page