5 replies
by masinick
Any UNIX-like operatiing system, which includes Linux, has a powerful set of features that you can effectively use to generate log files for your programs. Are you familiar with UNIX pipes (|) and filters (<>&)? With these process facilities, you can take the output of one program and pipe (using the pipe symbol, |) into the input of another program. But you can also direct the output of a program into a file, using output file redirection, represented by the > symbol.
Depending on how sophisticated you want to get with this, you can use Shell commands to put a date and time stamp on the log file, so that there is a unique log file for each ime you run your program. Moreover, it is possible to direct one or more output streams to the same file, (for example, using the directive 2>&1, which says, "Take the output from stderr and send that output to stdout". 2=stderr, 1=stdout, 0=stdin).
By using shell variables, file redirection, and time/date stamps, you can create a uniquelog file for every program instance. Send me Email if you want specific examples.
Brian W. Masinick
mailto:masinick@yahoo.com
by sudhakaran_c
by wls
$ man syslog
There is a wondeful, simple, and portable interface which will do all the kinds of things you want.
by sudhakaran_c
by sudhakaran_c
This discussion is closed to new replies.
Trending Linux posts
Sort by Trending