473,656 Members | 2,997 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A simple example of log

89 New Member
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 1332
pawanrpandey
14 New Member
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

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

Similar topics

4
4150
by: Paul Moore | last post by:
I hit a problem yesterday with my mail connection. In a desparate attempt to understand what was going on, I wanted to log the connection traffic. After a bit of searching, I found a post on c.l.p from Andrew Bennetts explaining how to run a port forwarder in 2 lines using Twisted. $ mktap portforward -p 8000 -h remote -d 20 $ twistd -f portforward.tap This looked brilliant - all I needed to do was add logging. A quick
4
2240
by: Richard Shea | last post by:
Hi - I'm trying to use ZODB but I'm having trouble getting started. Can anyone point me at a very simple example ? I've had a look at 'ZODB/ZEO Programming Guide' (http://zope.org/Wikis/ZODB/FrontPage/guide/node2.html) but although it's good stuff it's not clear to me how the pieces of example fit together to produce something that works. I've also read 'Introduction to the Zope Object Database'...
3
3684
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example program #include <list>
11
6510
by: Beeeeeeeeeeeeves | last post by:
Hi I'm looking for some .net example code on encryption: I don't want anything fancy, no complex third party components with sophisticated algorithms, explanations of principle, or "public/private key" confusion (which seems to be all google can come up with) - I just want a SIMPLE example of how I can encrypt a string and then get back the SAME STRING. I found an example on MSDN which involves compiling a DLL then using it in a test form, but...
0
7555
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and found none, so, I wrote one and decided to share it with you. It's a very simple one with few functions. I derived a DataGrid and added to it a DataTable to hold the data. The object itself is handling the synchronization between them, because...
7
1346
by: Mark Prenter | last post by:
Hi all, I'm fairly new to .NET and I haven't done much in C++ before, nothing complex anyway, but I have a pretty good understanding of programming in general. What I'm trying to do is create a .DLL that contains a lot of the functions and classes that I normally use. I've followed the examples from http://www.c-sharpcorner.com/2/pr12.asp which contains a pretty good example of creating a simple .DLL. Even though the example is in C#,...
0
1880
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
7
3763
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I understand it I need a PHP script that pulls the query and dumps the data into XML format, that is called by triggering a javascript event that reads that file with XMLhttprequest.
0
1812
by: minnie | last post by:
An AJAX Simple Example for PHP Article from http://www.joyistar.com Introduction: AJAX WebShop 3 Beta2 supports PHP programming by integrating PHP5 development environment. Here we will give an simple example to show you how to develop web applications by PHP in AJAX WebShop. 1, Notice We will use Access database in this example. Of course, you can use others you like. Database name: demo.mdb; Table name: product; Fields:
17
5807
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /* Simple Thread Object ______________________________________________________________*/ #include <pthread.h> extern "C" void* thread_entry(void*);
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.