From 766aae5a728e2ec53af43e4e65cf87c7e875e20b Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 25 Nov 2013 12:51:04 -0600 Subject: [PATCH] Add rolling log file. This commit modifies the logging to also log all output to a rolling log file in the btcd home directory under the logs folder. It uses a maximum size of 10MB per log file and a max rotation size of 3. This means the log files will not exceed 30 megabytes. --- config.go | 1 + log.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index f61a0a48..5f941a17 100644 --- a/config.go +++ b/config.go @@ -39,6 +39,7 @@ var ( knownDbTypes = btcdb.SupportedDBs() defaultRPCKeyFile = filepath.Join(btcdHomeDir, "rpc.key") defaultRPCCertFile = filepath.Join(btcdHomeDir, "rpc.cert") + defaultLogFile = filepath.Join(btcdHomeDir, "logs", "btcd.log") ) // config defines the configuration options for btcd. diff --git a/log.go b/log.go index 9e9f6584..e9651712 100644 --- a/log.go +++ b/log.go @@ -130,12 +130,14 @@ func newSeelogLogger() seelog.LoggerInterface { - + + - + ` + config = fmt.Sprintf(config, defaultLogFile) logger, err := seelog.LoggerFromConfigAsString(config) if err != nil {