On Fri, 2005-06-17 at 22:11, Robert Story wrote:
> With the introduction of the new log handling mechanism (linked list of log
> handler, instead of a single instance of each type), some new issues have
> arisen. I'd like to start a discussion on how to deal with them.

Just to check - are you talking about logging from the SNMP agent
specifically, or more generally about the underlying library log
routines.

> By default, a standard logfile has always been opened (/var/log/snmpd.log).

That sounds like the agent's logging in particular - yes?

One thing to bear in mind.  When I submitted the modular logging
code, this included the minimal changes needed for the agent to
make use of it.  I didn't rip out all of the agent-specific
logging code and replace it with fully new-style handling.

This was probably always needed, but I wanted to have some
discussion and feedback about the new mechanism first. You
know what a cautious coder I can be at times!


>  -l /dev/null  .... now spits out a warning to use '-Lf
> <file>' instead. Those who followed that advice were surprised
> to find out that the default log file was still created,
> The new log handler allows multiple log destinations, so
> setting one does not overwrite another.

That feels like the underlying source of the problem, IMO.
The first '-L' option (of whatever style) should probably
replace the default logging setting.  Any subsequent '-L'
options should augment this.

Or looked at another way - the agent (or any other application)
should probably check whether any logging has been set up,
and only set up the default mechanism if there's nothing
else in place:

    if (!get_logh_head())
        snmp_enable_filelog( LOGFILE );


> The new -Ln (no log handling) was of little help, since it
> disabled logs before the default file was opened.

Strange.  I'm sure I checked that it did when I added the
mechanism. Something must have broken it since.
   Anyway - the approach above should fix that as well.



> Possible solutions:
> 
> 1) set up default log before cmd line arg processing. '-Ln'
> will disable default, and '-Lf file' can set another.

<Retch!>

> 2) only set up the default location if no other logging option was set.

Yup.
I agree with that (see above).

Dave



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to