[command] logger ?

  • Follow


Hello,

I try to use the "logger" command, because I would like to add some log in a
file, but it doesn't work. I had a look in the man, and tried :

%> logger -t myTag -f /var/adm/myfile message

Normaly. it must return a value: 0 if everything's ok or >0 if there was a
problem, but for me, it returns nothing at all. And it didn't add the log in
the file sure.
What's the problem ?

Thank you.

--
Bc.


0
Reply Bc 7/28/2004 8:49:12 AM

In article <ce7p58$2k1$1@zcars0v6.ca.nortel.com>, Bc. wrote:

>I try to use the "logger" command, because I would like to add some log in a
>file, but it doesn't work. I had a look in the man, and tried :
>
>%> logger -t myTag -f /var/adm/myfile message
>
>Normaly. it must return a value: 0 if everything's ok or >0 if there was a
>problem, but for me, it returns nothing at all. And it didn't add the log in
>the file sure.
>What's the problem ?

Right after you've run this try "echo $status" (I'm guessing csh
from your prompt).  That should show the return value and it should
be a number - either zero or non-zero.  The return code is in $? in
most other shells.

Based on my linux man page here the file named with -f should be an
INPUT file that exists but you've provided a name that looks more
like an output file.  I'm not sure you should be using both "message"
and "-f".  There are some other issues that affect where your message
might end up after you enter it.

Have a look in /var/adm/messages just after running logger. 

-- 
Elvis Notargiacomo  master AT barefaced DOT cheek
http://www.notatla.org.uk/goen/
0
Reply elvis 7/28/2004 9:27:32 AM


> >I try to use the "logger" command, because I would like to add some log
in a
> >file, but it doesn't work. I had a look in the man, and tried :
> >
> >%> logger -t myTag -f /var/adm/myfile message
> >
> >Normaly. it must return a value: 0 if everything's ok or >0 if there was
a
> >problem, but for me, it returns nothing at all. And it didn't add the log
in
> >the file sure.
> >What's the problem ?
>
> Right after you've run this try "echo $status" (I'm guessing csh
> from your prompt).  That should show the return value and it should
> be a number - either zero or non-zero.  The return code is in $? in
> most other shells.

When I run echo $? (bash), it returns 0.

> Based on my linux man page here the file named with -f should be an
> INPUT file that exists but you've provided a name that looks more
> like an output file.  I'm not sure you should be using both "message"
> and "-f".  There are some other issues that affect where your message
> might end up after you enter it.

myfile is my input file. It is the log file where I want to add my personnal
log.

> Have a look in /var/adm/messages just after running logger.

I tried as well:  %> logger -t myTag message
Nothing added in messages.....

--
Bc.


0
Reply Bc 7/28/2004 10:23:13 AM

Bc. <moimoi.toi2@laposte.net> wrote:
> myfile is my input file. It is the log file where I want to add my personnal
> log.

I'm not sure if you really understood what the -f option is there for.
logger will read this file, and send its contents to the syslog daemon.
logger will not write anything to any file.

>> Have a look in /var/adm/messages just after running logger.
> 
> I tried as well:  %> logger -t myTag message
> Nothing added in messages.....

Is syslogd running on your system ? logger will log its messages
by default to syslog's user.notice facility (read the syslog.conf
man page on what this means). The default syslog.conf will not
log user.notice messages anywhere, so either you tell logger to
use a different facility, e.g.:

  logger -p daemon.notice message

(in a default Solaris setup, this message will show up in 
/var/adm/messages). Or you have to modify /etc/syslog.conf 
and send syslogd a HUP signal to make it log user.notice
to whatever file you like.

If you just want to add a line to an existing line, you probably
don't need logger at all, something like

  echo "message" >> /my/log/file

would suffice.

mp.
-- 
Systems Administrator | Institute for Software Science | Univ. of Vienna
0
Reply Martin 7/28/2004 10:58:03 AM

> Normaly. it must return a value: 0 if everything's ok or >0 if there was a
> problem, but for me, it returns nothing at all. And it didn't add the log
in
> the file sure.
> What's the problem ?

The `logger` command uses syslog facilities.  Is syslog running?


0
Reply UNIX 7/31/2004 9:13:10 AM

4 Replies
1077 Views

(page loaded in 0.051 seconds)

Similiar Articles:













7/20/2012 8:21:35 AM


Reply: