468,316 Members | 2,108 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,316 developers. It's quick & easy.

A simple example of log

89
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
Expand|Select|Wrap|Line Numbers
  1. Signal
for rotating. Please give me a small example. Thanks.

Expand|Select|Wrap|Line Numbers
  1. use Logfile::Rotate;
  2. $logfile = new Logfile::Rotate(
  3.                 File   => "/var/adm/log/syslog",
  4.                 Count  => 5,
  5.  
  6.                 Signal => 
  7.                    sub {
  8.                         open PID, "/etc/syslog.pid" or
  9.                            die "Unable to open pid file:$!\n";
  10.                         chomp($pid = <PID>);
  11.                         close PID;
  12.                         # should check validity first
  13.                         kill 'HUP', $pid; 
  14.                         }
  15.             );
Aug 8 '08 #1
1 1212
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:
Expand|Select|Wrap|Line Numbers
  1. Have a program doing something
  2. Want to print all activity of that program in a Log file
  3. Any specific operation I want to do
  4. Close the log file
etc...

Regards,
Pawan
Aug 8 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Paul Moore | last post: by
4 posts views Thread by Richard Shea | last post: by
3 posts views Thread by Patchwork | last post: by
11 posts views Thread by Beeeeeeeeeeeeves | last post: by
reply views Thread by Tal Sharfi | last post: by
7 posts views Thread by Mark Prenter | last post: by
reply views Thread by 42 | last post: by
7 posts views Thread by Ivan Marsh | last post: by
reply views Thread by minnie | last post: by
17 posts views Thread by Chris M. Thomasson | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.