Discussion Locked

Regarding log files

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
how can we use the log files for our developing softwares in linux? is there any special procedure for that? do u know any reference site please forward to me.

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 wls

$ man syslog

There is a wondeful, simple, and portable interface which will do all the kinds of things you want.

This discussion is closed to new replies.