[libvirt] [PATCH] util: conf: Don't log when adding commented out lines
Peter Krempa
pkrempa at redhat.com
Mon May 15 07:09:04 UTC 2017
On Fri, May 12, 2017 at 16:43:05 +0200, Martin Kletzander wrote:
> On Fri, May 12, 2017 at 04:33:29PM +0200, Peter Krempa wrote:
> > virConfAddEntry spams debug logs even for fully commented out lines.
> > Skip such messages to avoid:
> >
> > 2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
> > 2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
> > 2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
> > 2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
> > 2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
> > ...
> >
> > This also fixes NULL passed to printf.
> > ---
> > src/util/virconf.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/util/virconf.c b/src/util/virconf.c
> > index 9840ca6c7..4498d253a 100644
> > --- a/src/util/virconf.c
> > +++ b/src/util/virconf.c
> > @@ -238,7 +238,10 @@ virConfAddEntry(virConfPtr conf, char *name, virConfValuePtr value, char *comm)
> > if ((comm == NULL) && (name == NULL))
> > return NULL;
> >
> > - VIR_DEBUG("Add entry %s %p", name, value);
> > + /* don't log fully commented out lines */
> > + if (name)
> > + VIR_DEBUG("Add entry %s %p", name, value);
> > +
>
> Probably better then adding the comment to the debug message.
Yes, I tried that at first. It was awful.
>
> ACK
Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170515/40db7a67/attachment-0001.sig>
More information about the libvir-list
mailing list