[EMAIL PROTECTED] wrote:
>On Thu, 5 Apr 2001 [EMAIL PROTECTED] wrote:
>..
>> > i'd like to make a program that logs some output to a text
>> > file. i have a few questions here:
>> >
>> > 1) do i need to implement a locking mechanism? the
>> > program is web-accessible and many users may be accessing
>> > it simultaneously. i don't want the log file to get
>> > corrupted.
>> >
>>
>> Yes, of course. Or you can make a daemon program that uses SysVIPC
>> (or POSIX.1b message queues? are they already supported in Linux?) to
>> communicate with client processes, queueing each request that would
>> write to the log file.
>
>dats too complex. just write to a pipe, ala unix syslog. if you ensure
>that writes are atomic (you can use fcntl to do dat) i/o will be
>serialized. if its good enuff for syslog, its good enuff for you :
Or just call syslog(3). That should also answer your other concern of logging to
different servers.
Beware, syslog can be a CPU hog and logging over the network can be unreliable under
heavy loads.
JR
__________________________________
www.edsamail.com
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]
To subscribe to the Linux Newbies' List: send "subscribe" in the body to
[EMAIL PROTECTED]