A simple example of log

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lilly07
    New Member
    • Jul 2008
    • 89

    A simple example of log

    I am trying to write a log file and saw an eaxmple as below. The example forks and I don't need to do. I jsut want to open a log file and try to add into the log file and try with count parameter alone. Or do I have to use
    Code:
    Signal
    for rotating. Please give me a small example. Thanks.

    Code:
    use Logfile::Rotate;
    $logfile = new Logfile::Rotate(
                    File   => "/var/adm/log/syslog",
                    Count  => 5,
                    
                    Signal => 
                       sub {
                            open PID, "/etc/syslog.pid" or
                               die "Unable to open pid file:$!\n";
                            chomp($pid = <PID>);
                            close PID;
                            # should check validity first
                            kill 'HUP', $pid; 
                            }
                );
  • pawanrpandey
    New Member
    • Feb 2007
    • 14

    #2
    Could you please explain your requirement clearly? It is not very clear from your statements and provided code. If you can write in steps like:
    Code:
    Have a program doing something
    Want to print all activity of that program in a Log file
    Any specific operation I want to do
    Close the log file
    etc...

    Regards,
    Pawan

    Comment

    Working...