[libvirt] [PATCH] logging: fixing log level initialization from cmdline

Reorder code for setting default log level from cmdline prior initialization of log outputs. Thus the --verbose option is reflected. This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325072 --- src/logging/log_daemon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 8f1ccc2..9f71ca9 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -405,6 +405,12 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, virLogParseOutputs(config->log_outputs); /* + * Command line override for --verbose + */ + if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) + virLogSetDefaultPriority(VIR_LOG_INFO); + + /* * If no defined outputs, and either running * as daemon or not on a tty, then first try * to direct it to the systemd journal @@ -464,12 +470,6 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, VIR_FREE(tmp); } - /* - * Command line override for --verbose - */ - if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) - virLogSetDefaultPriority(VIR_LOG_INFO); - return 0; error: -- 1.8.3.1

On Fri, Jun 24, 2016 at 02:25:27PM +0200, Jaroslav Suchanek wrote:
Reorder code for setting default log level from cmdline prior initialization of log outputs. Thus the --verbose option is reflected.
This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325072 --- src/logging/log_daemon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 8f1ccc2..9f71ca9 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -405,6 +405,12 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, virLogParseOutputs(config->log_outputs);
/* + * Command line override for --verbose + */ + if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) + virLogSetDefaultPriority(VIR_LOG_INFO); + + /* * If no defined outputs, and either running * as daemon or not on a tty, then first try * to direct it to the systemd journal @@ -464,12 +470,6 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, VIR_FREE(tmp); }
- /* - * Command line override for --verbose - */ - if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) - virLogSetDefaultPriority(VIR_LOG_INFO); - return 0;
error:
The same pattern is present in lock_daemon.c too. Libvirtd seems to already use the pattern you're adding. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Fri, Jun 24, 2016 at 02:29:57PM +0100, Daniel P. Berrange wrote:
On Fri, Jun 24, 2016 at 02:25:27PM +0200, Jaroslav Suchanek wrote:
Reorder code for setting default log level from cmdline prior initialization of log outputs. Thus the --verbose option is reflected.
This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325072 --- src/logging/log_daemon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 8f1ccc2..9f71ca9 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -405,6 +405,12 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, virLogParseOutputs(config->log_outputs);
/* + * Command line override for --verbose + */ + if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) + virLogSetDefaultPriority(VIR_LOG_INFO); + + /* * If no defined outputs, and either running * as daemon or not on a tty, then first try * to direct it to the systemd journal @@ -464,12 +470,6 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, VIR_FREE(tmp); }
- /* - * Command line override for --verbose - */ - if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) - virLogSetDefaultPriority(VIR_LOG_INFO); - return 0;
error:
The same pattern is present in lock_daemon.c too. Libvirtd seems to already use the pattern you're adding.
Thank you Daniel for reminding. I checked only the libvirtd part. I will post v2 later. J.
participants (2)
-
Daniel P. Berrange
-
Jaroslav Suchanek