Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Sep 2000 23:41:20 -0700
From:      "Crist J . Clark" <cjclark@reflexnet.net>
To:        Frank Sonnemans <frank.sonnemans@euronet.be>
Cc:        questions@FreeBSD.ORG
Subject:   Re: setting syslog priority mask
Message-ID:  <20000929234120.P81242@149.211.6.64.reflexcom.com>
In-Reply-To: <20000929101643.A84987@zoe.sbs-online.com>; from frank.sonnemans@euronet.be on Fri, Sep 29, 2000 at 10:16:43AM %2B0200
References:  <20000929000208.B1567@scuba.sbs-online.com> <20000928202636.M81242@149.211.6.64.reflexcom.com> <20000929101643.A84987@zoe.sbs-online.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 29, 2000 at 10:16:43AM +0200, Frank Sonnemans wrote:
> Following the complete c source of my test program the recorded 
> messages in /var/log/messages and the contents of syslog.conf.
> 
> All the messages appear on the terminal,

Really? I don't see why they would.

> but the LOG_DEBUG and
> LOG_INFO messages do not appear in the /var/log/messages file.

That is expected.

> Probably I misconfigured my syslog.conf. I assumed that setting the
> mask from within my program would override the defaults in
> syslog.conf.

No, it does not, thankfully. It would not make a lot of sense since it
would make the configuration of syslog via syslog.conf kind of
pointless. It only has meaning within the program.

> The idea is to use setlogmask and command line options to
> control the logging level of an internet connection daemon which I am
> writing to connect my bsd box to the internet using ADSL.

You can do that, but not the way you think. You can control the level
by changing syslog.conf, or you can set syslog.conf at a fairly low
level and then use setlogmask() to raise the level at which the
program sends messages out.0

> Some explanation would be appreciated.

[snip code and messages]

> ----------------------------------------------------
> syslog.conf
> ----------------------------------------------------
> 
> # $FreeBSD: src/etc/syslog.conf,v 1.13 2000/02/08 21:57:28 rwatson Exp $
> #
> #	Spaces are NOT valid field separators in this file.
> #	Consult the syslog.conf(5) manpage.
> *.err;kern.debug;auth.notice;mail.crit		/dev/console
> *.notice;kern.debug;lpr.info;mail.crit;news.err	/var/log/messages
  ^^^^^^^^
That's the line catching stuff in your messages file.

> security.*					/var/log/security
> mail.info					/var/log/maillog
> lpr.info					/var/log/lpd-errs
> cron.*						/var/log/cron
> *.err						root
> *.notice;news.err				root

Are you running the code as root? These two would be sending it to
your terminal, but only at 'notice' and up.

> *.alert						root
> *.emerg						*
> # uncomment this to enable logging of all log messages to /var/log/all.log
> *.*						/var/log/all.log

All of your messages for your testing should be falling into this
file. If you want to cut down your testing to a single file,

  user.*					/var/log/user.test

Something like that might be good.

> # uncomment this to enable logging to a remote loghost named loghost
> #*.*						@loghost
> # uncomment these if you're running inn
> # news.crit					/var/log/news/news.crit
> # news.err					/var/log/news/news.err
> # news.notice					/var/log/news/news.notice
> !startslip
> *.*						/var/log/slip.log
> !ppp
> *.*						/var/log/ppp.log

So, if you were to add that user.* line, you can chose the level that
the program writes to the log by using setlogmask(). If you were to
have user.err, you can use setlogmask() to control whether messages
from err and up get logged, but no matter what, you can't log below
err since syslogd will read syslog.conf and not use them.
-- 
Crist J. Clark                           cjclark@alum.mit.edu


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000929234120.P81242>