logging: Log only for unhandled errors, remove all the debug logging. (#1652)

This patch brings in the removal of debug logging altogether, instead
we bring in the functionality of being able to trace the errors properly
pointing back to the origination of the problem.

To enable tracing you need to enable "MINIO_TRACE" set to "1" or "true"
environment variable which would print back traces whenever there is an
error which is unhandled or at the handler layer.

By default this tracing is turned off and only user level logging is
provided.
This commit is contained in:
Harshavardhana
2016-05-16 14:31:28 -07:00
committed by Anand Babu (AB) Periasamy
parent 8828fd1e5c
commit 9472299308
38 changed files with 166 additions and 731 deletions
+1 -16
View File
@@ -19,8 +19,6 @@ package main
import (
"sort"
"strings"
"github.com/Sirupsen/logrus"
)
// Common initialization needed for both object layers.
@@ -198,7 +196,6 @@ func listObjectsCommon(layer ObjectLayer, bucket, prefix, marker, delimiter stri
var fileInfos []FileInfo
var eof bool
var nextMarker string
log.Debugf("Reading from the tree walk channel has begun.")
for i := 0; i < maxKeys; {
walkResult, ok := <-walker.ch
if !ok {
@@ -208,12 +205,6 @@ func listObjectsCommon(layer ObjectLayer, bucket, prefix, marker, delimiter stri
}
// For any walk error return right away.
if walkResult.err != nil {
log.WithFields(logrus.Fields{
"bucket": bucket,
"prefix": prefix,
"marker": marker,
"recursive": recursive,
}).Debugf("Walk resulted in an error %s", walkResult.err)
// File not found is a valid case.
if walkResult.err == errFileNotFound {
return ListObjectsInfo{}, nil
@@ -230,12 +221,6 @@ func listObjectsCommon(layer ObjectLayer, bucket, prefix, marker, delimiter stri
i++
}
params := listParams{bucket, recursive, nextMarker, prefix}
log.WithFields(logrus.Fields{
"bucket": params.bucket,
"recursive": params.recursive,
"marker": params.marker,
"prefix": params.prefix,
}).Debugf("Save the tree walk into map for subsequent requests.")
if !eof {
saveTreeWalk(layer, params, walker)
}
@@ -268,7 +253,7 @@ func isBucketExist(storage StorageAPI, bucketName string) bool {
if err == errVolumeNotFound {
return false
}
log.Errorf("StatVol failed with %s", err)
errorIf(err, "Stat failed on bucket "+bucketName+".")
return false
}
return true