|
@@ -20,6 +20,9 @@ var FileLog = logrus.New()
|
|
|
var Binlog *logs.BeeLogger
|
|
|
|
|
|
func init() {
|
|
|
+ if LogMaxDays == 0 {
|
|
|
+ LogMaxDays = 30
|
|
|
+ }
|
|
|
logPath := LogPath
|
|
|
if logPath == "" {
|
|
|
logPath = DefaultLogPath
|
|
@@ -33,7 +36,6 @@ func init() {
|
|
|
|
|
|
logFileName := path.Join(logPath, logFile)
|
|
|
logConf := getDefaultLogrusConfig(logFileName)
|
|
|
- logConf.MaxAge = 1
|
|
|
|
|
|
rolling(FileLog, logConf)
|
|
|
|
|
@@ -47,7 +49,6 @@ func init() {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
initBinlog()
|
|
|
}
|
|
@@ -96,11 +97,11 @@ func rolling(fLog *logrus.Logger, config *lumberjack.Logger) {
|
|
|
|
|
|
func getDefaultLogrusConfig(logFile string) (config *lumberjack.Logger) {
|
|
|
config = &lumberjack.Logger{
|
|
|
- Filename: logFile,
|
|
|
- MaxSize: 256,
|
|
|
- MaxBackups: 3,
|
|
|
- MaxAge: 7,
|
|
|
- Compress: true,
|
|
|
+ Filename: logFile,
|
|
|
+ MaxSize: 256,
|
|
|
+ MaxBackups: 0,
|
|
|
+ MaxAge: LogMaxDays,
|
|
|
+ Compress: true,
|
|
|
LocalTime: true,
|
|
|
}
|
|
|
return
|
|
@@ -112,7 +113,7 @@ func getDefaultLogConfig() logConfig {
|
|
|
MaxLines: 0,
|
|
|
MaxSize: 1 << 28,
|
|
|
Daily: true,
|
|
|
- MaxDays: 7,
|
|
|
+ MaxDays: LogMaxDays,
|
|
|
Rotate: true,
|
|
|
Level: logs.LevelTrace,
|
|
|
|