diff --git a/conf.sample.yml b/conf.sample.yml index 9dabfc3..13cf780 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -50,7 +50,7 @@ # LogLevel: 'info' # default: info. can be debug|info|warn|error # Log: -# Outputs: 'stderr' # default: stderr, split by |, you can append files to Outputs if need. example:'stderr|/tmp/test.log' +# Outputs: 'stderr' # default: stderr, split by ",", you can append files to Outputs if need. example:'stderr,/tmp/test.log' # RotationEnable: 0 # default: 0 # RotationConfigJson: '{}' # example: '{"maxsize": 100, "maxage": 0, "maxbackups": 0, "localtime": false, "compress": false}' diff --git a/dtmcli/logger/log.go b/dtmcli/logger/log.go index 45048b1..dde58c1 100644 --- a/dtmcli/logger/log.go +++ b/dtmcli/logger/log.go @@ -49,7 +49,7 @@ func InitLog(level string) { // InitLog2 specify advanced log config func InitLog2(level string, outputs string, logRotationEnable int64, logRotateConfigJSON string) { - outputPaths := strings.Split(outputs, "|") + outputPaths := strings.Split(outputs, ",") for i, v := range outputPaths { if logRotationEnable != 0 && v != StdErr && v != StdOut { outputPaths[i] = fmt.Sprintf("lumberjack://%s", v) diff --git a/dtmcli/logger/logger_test.go b/dtmcli/logger/logger_test.go index 49035c2..d55b6d6 100644 --- a/dtmcli/logger/logger_test.go +++ b/dtmcli/logger/logger_test.go @@ -17,12 +17,12 @@ func TestInitLog(t *testing.T) { FatalfIf(false, "nothing") FatalIfError(nil) - InitLog2("debug", "test.log|stderr", 0, "") + InitLog2("debug", "test.log,stderr", 0, "") Debugf("a debug msg to console and file") - InitLog2("debug", "test2.log|/tmp/dtm-test1.log|/tmp/dtm-test.log|stdout|stderr", 1, + InitLog2("debug", "test2.log,/tmp/dtm-test1.log,/tmp/dtm-test.log,stdout,stderr", 1, "{\"maxsize\": 1, \"maxage\": 1, \"maxbackups\": 1, \"compress\": false}") - Debugf("a debug msg to /tmp/dtm-test.log|test2.log|stdout|stderr") + Debugf("a debug msg to /tmp/dtm-test.log and test2.log and stdout and stderr") // _ = os.Remove("test.log") }