[libvirt] [PATCH 2/6] Change default log policy to libvirtd.log instead of syslog

Daniel P. Berrange berrange at redhat.com
Fri Mar 4 11:30:57 UTC 2011


On Fri, Mar 04, 2011 at 06:30:53PM +0800, Daniel Veillard wrote:
> 
> Syslog is not the best place to go search for libvirt error
> logs, change it to a default file output libvirtd.log, but
> still keep standard error if not run as a daemon.
> Depending on whether it's run as root or user, the log is saved
> in the local state dir or in $HOME/.libvirt.
> * daemon/libvirtd.c: change default logging to go to libvirtd.log
> 
> Signed-off-by: Daniel Veillard <veillard at redhat.com>
> ---
>  daemon/libvirtd.c |   56 ++++++++++++++++++++++++++++++++++++++++------------
>  1 files changed, 43 insertions(+), 13 deletions(-)

ACK

> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index b2e5e20..ebed828 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -197,6 +197,8 @@ static int audit_logging = 0;
>  
>  #define DH_BITS 1024
>  
> +static int logFD = -1;

Just need to delete this.

> +
> +/*
> + * Stop logging
> + */
> +static void
> +qemudStopLogging(void)
> +{
> +    virLogShutdown();
> +    VIR_FORCE_CLOSE(logFD);
>  }

No need for this new function now.


>  /* Read the config file if it exists.
> @@ -2805,7 +2835,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
>      /*
>       * First get all the logging settings and activate them
>       */
> -    if (qemudSetLogging(conf, filename) < 0)
> +    if (qemudSetLogging(server, conf, filename) < 0)
>          goto free_and_fail;
>  
>      GET_CONF_INT (conf, filename, listen_tcp);
> @@ -3369,6 +3399,6 @@ error:
>          qemudCleanup(server);
>      if (pid_file)
>          unlink (pid_file);
> -    virLogShutdown();
> +    qemudStopLogging();

So this chunk can just disappear too

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 :|




More information about the libvir-list mailing list