On Sat, Jan 23, 2016 at 12:39:19PM -0600, Brent Cook wrote:
> I'm going with this instead. That way it works like the manual
> specifies already (-v enables logging debug messages)
>
Yes, the -v flag is better, but see below.
> cvs server: Diffing .
> Index: ntpd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
> retrieving revision 1.103
> diff -u -p -r1.103 ntpd.c
> --- ntpd.c 11 Jan 2016 15:30:56 -0000 1.103
> +++ ntpd.c 23 Jan 2016 18:36:52 -0000
> @@ -138,7 +138,7 @@ main(int argc, char *argv[])
> switch (ch) {
> case 'd':
> lconf.debug = 1;
> - log_verbose(1);
> + log_verbose(2);
This will get overridden by the various log_init() calls later.
You should better set a "verbose" variable in the switch statements
and call log_verbose() after the various log_init() calls later
(ntpd's puristic privsep has to call it in various places).
log_init(..)
log_verbose(verbose)
Splitting log_init() and log_verbose() allowed us to change the
verbose flag during runtime; for example "relayctl verbose" allows to
toggle the flag and calls log_verbose() internally. Maybe ntpctl is
too minimalistic for it, but I would prefer if ntpd could follow the
same/similar semantics in its main().
Reyk
> break;
> case 'f':
> conffile = optarg;
> @@ -153,7 +153,7 @@ main(int argc, char *argv[])
> lconf.settime = 0;
> break;
> case 'v':
> - log_verbose(1);
> + log_verbose(2);
> break;
> default:
> usage();
>
> On Wed, Jan 20, 2016 at 7:23 AM, Sebastian Benoit <[email protected]> wrote:
> > in relayd we use -v for that, so you need to run -dvvvv to get lots of
> > output. check main() there?
> >
> > i think thats more intuitive, but maybe i'm just used to it.
> >
> > Brent Cook([email protected]) on 2016.01.20 06:31:44 -0600:
> >> Since the relatively recent logging unification, log_init needs a
> >> debug level > 1 in order for log_debug to print anything. This change
> >> makes it so 'ntpd -d' stays in the foreground but doesn't log much
> >> (the current behavior, different than previous releases though), 'ntpd
> >> -dd' actually prints more verbose debug messages.
> >>
> >> Index: ntpd.8
> >> ===================================================================
> >> RCS file: /cvs/src/usr.sbin/ntpd/ntpd.8,v
> >> retrieving revision 1.40
> >> diff -u -p -u -p -r1.40 ntpd.8
> >> --- ntpd.8 30 Oct 2015 16:41:53 -0000 1.40
> >> +++ ntpd.8 20 Jan 2016 12:31:16 -0000
> >> @@ -50,6 +50,7 @@ If this option is specified,
> >> .Nm
> >> will run in the foreground and log to
> >> .Em stderr .
> >> +It may be specified again to enable more verbose debug logs.
> >> .It Fl f Ar file
> >> Use
> >> .Ar file
> >> Index: ntpd.c
> >> ===================================================================
> >> RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
> >> retrieving revision 1.103
> >> diff -u -p -u -p -r1.103 ntpd.c
> >> --- ntpd.c 11 Jan 2016 15:30:56 -0000 1.103
> >> +++ ntpd.c 20 Jan 2016 12:31:16 -0000
> >> @@ -137,7 +137,7 @@ main(int argc, char *argv[])
> >> while ((ch = getopt(argc, argv, "df:nsSv")) != -1) {
> >> switch (ch) {
> >> case 'd':
> >> - lconf.debug = 1;
> >> + lconf.debug++;
> >> log_verbose(1);
> >> break;
> >> case 'f':
> >>
> >
> > --
>
--