Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Is print faster than syswrite?

by saurabh.hirani (Beadle)
on Jan 28, 2009 at 05:02 UTC ( [id://739415]=note: print w/replies, xml ) Need Help??


in reply to Re: Is print faster than syswrite?
in thread Is print faster than syswrite?

Thanks a lot for your responses guys. I appreciate your viewpoints.

I have used syslog till now for all of my work and it works like charm. But we wanted to have a logging module which we can customize from ground up and through which we can do the following:


1. log to file or database directly. I know that logging to a database would be a major I/O hit so read on.
2. log to a file using standard templates. As in I should be able to make a call like
$logobj(245, {'name' => 'saurabh', 'game' => 'tennis'})

That would check whether 245 is a valid message template id in a db file and if it is log a message to the log file of the format - program_name|program_action|tmpl_id|tmpl_params

This log file output would be uploaded to the database on a regular basis (better than doing the database directly) and then reporting would be a much easier job.


3. We wanted logging on a per program basis and not a facility, priority basis.
4. We wanted to enforce the method of logging to be extremely uniform. It is better to use templates than to assume that the next guy will surely follow the "Failed to open file $file" rather than "Opening of file $file failed"

As far as reinventing the wheel goes, I had to - as the wheel of a jeep cannot be used in a Jaguar. :)
I haven't used this work till now in production environment. So will see how it goes.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://739415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-18 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found