944,031 Members | Top Members by Rank

Ad:
Jan 16th, 2007
0

Handling log files in UNIX

Expand Post »
Hi,

What is a log file?What is its purpose?How do I open, read and write to log files?

Thanks,
Toms
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
titotoms is offline Offline
2 posts
since Nov 2006
Jan 16th, 2007
0

Re: Handling log files in UNIX

A log file is a record of what has happened. On linux/unix they tend to be in /var/log.

As a developer I use them when stuff goes wrong and I want to find out why.

IT use them to keep tabs on things, monitor network use etc.

Web masters use them to spot trends and stuff (often using something to interpret their log files like webalizer).

You write to a log file like any other text file. To read from one just type cat filename.log or tail filename.log.

A useful way of printing the end of a log file and update it when it changes is to use tail -f filename.log.
pty
Reputation Points: 64
Solved Threads: 39
Posting Pro
pty is offline Offline
530 posts
since Oct 2005
Jul 16th, 2010
0

create and start write into log file

LOG_FILE=/home/iocca_d/app/logs/logfilename.LOG
exec 1>> ${LOG_FILE}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lalchand Saini is offline Offline
1 posts
since Jul 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: makefile compile gsl and numerical recipes
Next Thread in Shell Scripting Forum Timeline: Find duplicate files





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC