Hi again
The Question of Logs, part II. :)
What are the advantages/disadvantages of using syslog() to do the logging
rather than writing the logs with fopen(), fwrite() and fclose()? What
should be kept in mind while using either technique? And, of course,
which is considered to be the better one?
TIA
Mike 5 3361
Micha? Wo?niak <mikiwoz_remove_this@yahoo_remove_this.co.uk> wrote: The Question of Logs, part II. :)
What are the advantages/disadvantages of using syslog() to do the logging rather than writing the logs with fopen(), fwrite() and fclose()?
It well tested, distributed (if need/want to) and "thread safe".
What should be kept in mind while using either technique? And, of course, which is considered to be the better one?
You oblivous forgot locking.
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable Daniel Tryba's handwriting: Micha? Wo?niak <mikiwoz_remove_this@yahoo_remove_this.co.uk> wrote: The Question of Logs, part II. :)
What are the advantages/disadvantages of using syslog() to do the logging rather than writing the logs with fopen(), fwrite() and fclose()? It well tested, distributed (if need/want to) and "thread safe".
What should be kept in mind while using either technique? And, of course, which is considered to be the better one?
You oblivous forgot locking.
Well, Malcolm wrote in the previous thread (sorry for a long quote):
Assuming you are on Linux or Unix.
Open the log file for append, and write entire lines at a time, no locking is required (note append mode, that's the key).
Up to a large size, (something like 64,000 bytes typical) each such line is guaranteed to be written as a single atomic unit to the end of the file, no locking required. This*is*a*documented*feature*of*append*mode*on unix, and is done exactly for this kind of situation.
(In practise you rarely even have to write whole lines at a time, because the program's file write will normally buffer your output and write it one line at a time even if you don't do that part explicitly your self.)"
So I suppose The File Way is as "thread-safe" (when opened in append
mode, that is) and I don't need locking anyway. Am I missing something?
Cheers
Mike
Micha? Wo?niak <mikiwoz_remove_this@yahoo_remove_this.co.uk> wrote: Hi again
The Question of Logs, part II. :)
What are the advantages/disadvantages of using syslog() to do the logging rather than writing the logs with fopen(), fwrite() and fclose()? What should be kept in mind while using either technique? And, of course, which is considered to be the better one?
TIA Mike
If the file system starts to fill up, most implementations of syslog
stop logging rather than bringing the system to a screeching halt.
Most implementations of syslog come with utilities to periodically
compress, remove, or backup syslog files.
It is trivial to change the level of logging while executing with
syslog.
Where the syslog files are and how to deal with them is already
documented by the system documentation and already known by
administrators.
Numerous utilities exist to get reports out of syslog.
It is trivial with syslog to log the pid, program name, time, any
system error messages and exact line which caused the log entry.
Reinventing the wheel is poor form.
--
Jim Pennino
Remove .spam.sux to reply.
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable ji**@specsol.spam.sux.com's handwriting: If the file system starts to fill up, most implementations of syslog stop logging rather than bringing the system to a screeching halt.
Most implementations of syslog come with utilities to periodically compress, remove, or backup syslog files.
It is trivial to change the level of logging while executing with syslog.
Where the syslog files are and how to deal with them is already documented by the system documentation and already known by administrators.
Numerous utilities exist to get reports out of syslog.
It is trivial with syslog to log the pid, program name, time, any system error messages and exact line which caused the log entry.
Geez, lots of it. Fine, I am convinced, thanks.
Reinventing the wheel is poor form.
However I do consider re-inventing the wheel sometimes useful - such a
learing project like the one I am actually working on right now is
enough for an example.
But I will stick to syslog to do the logging. Too many advantages. :)
Thanks again
Mike
Micha? Wo?niak <mikiwoz_remove_this@yahoo_remove_this.co.uk> wrote:
[snip] You oblivous forgot locking. Well, Malcolm wrote in the previous thread (sorry for a long quote):
Assuming you are on Linux or Unix.
Open the log file for append, and write entire lines at a time, no locking is required (note append mode, that's the key).
[snip] So I suppose The File Way is as "thread-safe" (when opened in append mode, that is) and I don't need locking anyway. Am I missing something?
It appears to be true indeed. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Erich Trowbridge |
last post by:
Has anybody seen this tool? It is awesome. check out
http://vw.vermeer.org/ . It's a php front end for large-scale syslog
deployments. It makes managing syslog in large networks a snap.
The idea...
|
by: Stephen Touset |
last post by:
--=-vqiBeaRpc7WKjfgJmDzK
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Is there now a way within MySQL to log to syslog? I was reading an
archived email conversation...
|
by: Gregory Starck |
last post by:
Hello,
I'm having what seems to be a deadlock in syslog with the code (wich
comes from a project I'm working on, but I've reduced the test case to
its minimum) I put at the end of this messsage....
|
by: Guy Noir |
last post by:
Hello.
I am needing some advice. I need to build a syslog server that writes
to a sql backend.
I am concerned about the server not being able to handle multiple
requests. For example on an...
|
by: greg |
last post by:
Hi All,
Could anyone tell me how I could syslog to a specific log (e.g. /var/
log/daemon.log, /var/log/syslog.log...)?
Thanks very much in advance!
-Greg
|
by: johnhelen |
last post by:
hello
In a perl script for a cronjob, there is a function:
sub _write_sys_log {
my $seft = shift;
my $level = shift;
my $string = shift;
syslog($level, '%s', "$string");
|
by: Troels Arvin |
last post by:
Hello,
On a server with DB2 v. 8.2, db2diag.log ran full, it seems (i.e. reached
a size of 2GB). And it seems that in this case, DB2 started using syslog
instead.
I would actually like DB2 to...
|
by: anjaliraman2 |
last post by:
Hi All,
I am facing a problem of writing into and reading from syslog in
Linux Enviornment using C++. The CPU utilization is extremely high of
about 55% and is creating problems for other...
|
by: Lincoln Yeoh |
last post by:
Hi,
I've just started to learn python (I've been using perl for some years).
How do I redirect ALL stderr stuff to syslog, even stderr from
external programs that don't explicitly change their...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
|
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...
| |