Bug 1442947

Summary: "virtlogd --verbose" doesn't output verbose messages
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Fangge Jin <fjin>
Severity: low Docs Contact:
Priority: low    
Version: 7.4CC: dyuan, eskultet, rbalakri, xuzhang, yafu, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.7.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 10:42:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fangge Jin 2017-04-18 07:24:35 UTC
Description of problem:
"virtlogd --verbose" doesn't output verbose messages

Version-Release number of selected component (if applicable):
libvirt-3.2.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
0.Don't change log setting in /etc/libvirt/virtlog.conf:
# grep '^log' /etc/libvirt/virtlogd.conf
(nothing output)

1.stop virtlogd
# systemctl stop virtlogd.socket

2.
# virtlogd --verbose
(No log printed)
^C

3.Change log_level to 3 or 4, the result is same as step 2.

4.Change log_level to 2:
# grep '^log' /etc/libvirt/virtlogd.conf
log_level = 2

5.
# virtlogd --verbose
2017-04-18 07:19:24.865+0000: 8854: info : libvirt version: 3.2.0, package: 2.virtcov.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2017-04-10-10:58:42, x86-038.build.eng.bos.redhat.com)
2017-04-18 07:19:24.865+0000: 8854: info : hostname: intel-5205-32-1.englab.nay.redhat.com
2017-04-18 07:19:24.865+0000: 8854: info : virObjectNew:202 : OBJECT_NEW: obj=0x557a035a2ec0 classname=virNetServer
2017-04-18 07:19:24.865+0000: 8854: info : virObjectNew:202 : OBJECT_NEW: obj=0x557a035a22a0 classname=virNetDaemon
2017-04-18 07:19:24.865+0000: 8854: info : virEventPollAddHandle:140 : EVENT_POLL_ADD_HANDLE: watch=1 fd=5 events=1 cb=0x557a0188da60 opaque=(nil) ff=(nil)
2017-04-18 07:19:24.865+0000: 8854: info : virObjectRef:296 : OBJECT_REF: obj=0x557a035a2ec0
2017-04-18 07:19:24.865+0000: 8854: info : virObjectNew:202 : OBJECT_NEW: obj=0x557a035a2950 classname=virLogHandler
2017-04-18 07:19:24.865+0000: 8854: info : virObjectNew:202 : OBJECT_NEW: obj=0x557a035a3020 classname=virNetServerService
2017-04-18 07:19:24.865+0000: 8854: info : virObjectNew:202 : OBJECT_NEW: obj=0x557a035a3ea0 classname=virNetSocket
2017-04-18 07:19:24.865+0000: 8854: info : virNetSocketNew:292 : RPC_SOCKET_NEW: sock=0x557a035a3ea0 fd=7 errfd=-1 pid=0 localAddr=127.0.0.1;0, remoteAddr=<null>
......

As shown above, there are info logs printed.

Actual results:
"virtlogd --verbose" doesn't output verbose messages when log_level is not set or set to 3/4.

Expected results:
"virtlogd --verbose" can output verbose messages when log_level is not set or set to 3/4, which is equal to setting log_level=2

Comment 2 Erik Skultety 2017-08-28 14:38:13 UTC
*** Bug 1457193 has been marked as a duplicate of this bug. ***

Comment 3 Erik Skultety 2017-08-28 14:44:40 UTC
Fixed upstream by:

commit b988f794e307fc6421ea7b13292a048bdca94f6a
Refs: v3.6.0-216-gb988f794e
Author:     Erik Skultety <eskultet>
AuthorDate: Fri Aug 25 16:58:51 2017 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Mon Aug 28 16:42:13 2017 +0200

    daemon: logging: Fix --verbose option being ignored by the daemon

    Commit 94c465d0 refactored the logging setup phase but introduced an
    issue, where the daemon ignores verbose mode when there are no outputs
    defined and the default must be used. The problem is that the default
    output was determined too early, thus ignoring the potential '--verbose'
    option taking effect. This patch postpones the creation of the default
    output to the very last moment when nothing else can change. Since the
    default output is only created during the init phase, it's safe to leave
    the pointer as NULL for a while, but it will be set eventually, thus not
    affecting runtime.
    Patch also adjusts both the other daemons.

    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1442947

    Signed-off-by: Erik Skultety <eskultet>

Comment 5 Fangge Jin 2017-11-06 03:28:30 UTC
Verify on build libvirt-3.8.0-1.el7.x86_64.

Test these scenarios:
# libvirtd --verbose
# virtlogd --verbose
# virtlockd --verbose

Comment 9 errata-xmlrpc 2018-04-10 10:42:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704