[lxc-devel] [lxd/master] 2016 09 20/logging issue 1928

brauner on Github lxc-bot at linuxcontainers.org
Tue Sep 20 09:06:03 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 391 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160920/9c9bdd81/attachment.bin>
-------------- next part --------------
From 397cef5deb76d0f4def4dec4a62788abe418a59f Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at canonical.com>
Date: Tue, 20 Sep 2016 09:48:03 +0200
Subject: [PATCH 1/2] lxd/daemon: adapt log levels

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>
---
 lxd/daemon.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lxd/daemon.go b/lxd/daemon.go
index bd3e677..9c6c4a5 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -772,7 +772,7 @@ func (d *Daemon) Init() error {
 	go func() {
 		t := time.NewTicker(24 * time.Hour)
 		for {
-			shared.LogDebugf("Expiring log files")
+			shared.LogInfof("Expiring log files")
 
 			err := d.ExpireLogs()
 			if err != nil {
@@ -792,6 +792,7 @@ func (d *Daemon) Init() error {
 	)
 
 	/* Setup /dev/lxd */
+	shared.LogInfof("Starting /dev/lxd handler")
 	d.devlxd, err = createAndBindDevLxd()
 	if err != nil {
 		return err
@@ -1094,18 +1095,21 @@ func (d *Daemon) Stop() error {
 	}
 
 	if n, err := d.numRunningContainers(); err != nil || n == 0 {
-		shared.LogDebugf("Unmounting shmounts")
+		shared.LogInfof("Unmounting shmounts")
 
 		syscall.Unmount(shared.VarPath("shmounts"), syscall.MNT_DETACH)
+
+		shared.LogInfof("Done unmounting shmounts")
 	} else {
 		shared.LogDebugf("Not unmounting shmounts (containers are still running)")
 	}
 
-	shared.LogDebugf("Closing the database")
+	shared.LogInfof("Closing the database")
 	d.db.Close()
 
-	shared.LogDebugf("Stopping /dev/lxd handler")
+	shared.LogInfof("Stopping /dev/lxd handler")
 	d.devlxd.Close()
+	shared.LogInfof("Stopped /dev/lxd handler")
 
 	if d.MockMode || forceStop {
 		return nil

From d09e62c351e0db26b5888528625663af0a8ce8f3 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at canonical.com>
Date: Tue, 20 Sep 2016 09:54:41 +0200
Subject: [PATCH 2/2] lxd/images: adapt log levels

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>
---
 lxd/images.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lxd/images.go b/lxd/images.go
index 4486165..3f43e20 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -853,7 +853,7 @@ func imagesGet(d *Daemon, r *http.Request) Response {
 var imagesCmd = Command{name: "images", post: imagesPost, untrustedGet: true, get: imagesGet}
 
 func autoUpdateImages(d *Daemon) {
-	shared.LogDebugf("Updating images")
+	shared.LogInfof("Updating images")
 
 	images, err := dbImagesGet(d.db, false)
 	if err != nil {
@@ -912,11 +912,11 @@ func autoUpdateImages(d *Daemon) {
 		}
 	}
 
-	shared.LogDebugf("Done updating images")
+	shared.LogInfof("Done updating images")
 }
 
 func pruneExpiredImages(d *Daemon) {
-	shared.LogDebugf("Pruning expired images")
+	shared.LogInfof("Pruning expired images")
 
 	// Get the list of expires images
 	expiry := daemonConfig["images.remote_cache_expiry"].GetInt64()
@@ -933,7 +933,7 @@ func pruneExpiredImages(d *Daemon) {
 		}
 	}
 
-	shared.LogDebugf("Done pruning expired images")
+	shared.LogInfof("Done pruning expired images")
 }
 
 func doDeleteImage(d *Daemon, fingerprint string) error {


More information about the lxc-devel mailing list