In addition... if you must have a separate file the syslog daemon can be
configured to route certain messages a separate file.
As to the GDG process, the logrotate function can do that for you. It
is probably already set up for syslog, but if you change the syslog
config to write your messages to a separate file some minor tweaking
will be needed.
David Boyes wrote:
I'm looking for a __simple__ way to approach this. I would like to
create a "log" type file from an application. Instead of logging to a
specific file name each time, I would like to log to a "base name"
which
then appends an ever increasing number on the end. This is like a GDG
in
z/OS, where I just specify DSN=SOME.NAME(+1) and the system generates
the next GDG number in sequence. So far, the best that I've come up
with
is something like:
There is a C function called tmpnam that will create a temporary file
name for you, but there isn't a concept of a GDG; you get a name
generated by the call which is seldom human predictable.
A suggestion, though: Rather than invent your own logging, use syslog.
It's better integrated with management tools, and you don't have to
worry about the file storage at all, and your operators only have one
place to look for problems.
For C or other compiled languages, #include syslog.h in your program,
and then use openlog/syslog/closelog to write messages.
For scripts, you can use 'logger' in to do the same job. Creating the
log entry becomes something like:
logger -p local0.notice -t MYHOST: 'Application Foo Borked Itself.
Please check it.'
Much easier and much more system management friendly.
-- db
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
Rich Smrcina
VM Assist, Inc.
Phone: 414-491-6001
Ans Service: 360-715-2467
rich.smrcina at vmassist.com
http://www.linkedin.com/in/richsmrcina
Catch the WAVV! http://www.wavv.org
WAVV 2008 - Chattanooga - April 18-22, 2008
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390