Computing.Net > Forums > Unix > newbie logging

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

newbie logging

Reply to Message Icon

Name: mike
Date: May 1, 2003 at 09:48:34 Pacific
OS: sun
CPU/Ram: sun
Comment:

I'm trying to get the date and error message to show up in a log file on the same line. Can anyone help?

#!/bin/sh
#Set Environment
OMNIBIN=/opt/Omnibus/bin
PROBE_LOG=/opt/Omnibus/log
echo $1 "switching probe to chis25" > $PROBE_LOG/probe.log



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: May 1, 2003 at 10:30:41 Pacific
Reply:

Is "/opt/Omnibus/log" a directory ?
Does the user executing this script have write permissions to that directory ?
Is "/opt/Omnibus/log/probe.log" a file under that directory that the user has write priviledges to ?


0

Response Number 2
Name: Don Arnett
Date: May 2, 2003 at 15:27:19 Pacific
Reply:

A little more specificity and less seemingly irrelevant detail would be helpful.

Assuming that the real question is how to write both a date and error message on the same line to a log file, generally speaking, do the following:


echo `date` error message > logfilename

or

echo "`date` error message" > logfilename

or possibly you'll want to use >> so that the line is appended to the file


NOTE that the quotes around "date" are backward quotes. This causes the date command to be run and the output of the command to be use by the echo command (meaning the date will be output to the file).


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: newbie logging

Redirecting log info www.computing.net/answers/unix/redirecting-log-info/5710.html

erro-log file www.computing.net/answers/unix/errolog-file/3276.html

Remote logging onto a Linux box www.computing.net/answers/unix/remote-logging-onto-a-linux-box/4728.html