Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 8th, 2008, 03:39 AM
Member
 
Join Date: Jul 2008
Posts: 41
Default 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
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.             );
Reply
  #2  
Old August 8th, 2008, 11:23 PM
pawanrpandey's Avatar
Newbie
 
Join Date: Feb 2007
Location: Bangalore
Posts: 11
Default

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

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles