diff --git a/server/config.yaml b/server/config.yaml index 5673c945..66b4a319 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -47,4 +47,4 @@ log: prefix: '[GIN-VUE-ADMIN]' log-file: true stdout: 'DEBUG' - file: 'WARNING' + file: 'DEBUG' diff --git a/server/core/log.go b/server/core/log.go index 3acded08..cde1be8c 100644 --- a/server/core/log.go +++ b/server/core/log.go @@ -15,7 +15,7 @@ import ( const ( logDir = "log" - logSoftLink = "api.log" + logSoftLink = "latest_log" module = "gin-vue-admin" ) @@ -56,11 +56,11 @@ func registerFile(c config.Log, backends []oplogging.Backend) []oplogging.Backen fmt.Println("create log directory") _ = os.Mkdir(logDir, os.ModePerm) } - apiLogPath := logDir + string(os.PathSeparator) + logSoftLink + //apiLogPath := logSoftLink fileWriter, err := rotatelogs.New( - apiLogPath+".%Y-%m-%d-%H-%M.log", + logDir+string(os.PathSeparator)+"%Y-%m-%d-%H-%M.log", // generate soft link, point to latest log file - rotatelogs.WithLinkName(apiLogPath), + rotatelogs.WithLinkName(logSoftLink), // maximum time to save log files rotatelogs.WithMaxAge(7*24*time.Hour), // time period of log file switching