|
@@ -36,6 +36,7 @@ func init() {
|
|
|
// 设置日志输出JSON格式
|
|
|
jsonFormat := new(logrus.JSONFormatter)
|
|
|
jsonFormat.DisableHTMLEscape = true
|
|
|
+ jsonFormat.TimestampFormat = HlbFormatDateTime
|
|
|
FileLog.SetFormatter(jsonFormat)
|
|
|
FileLog.SetReportCaller(true)
|
|
|
//LogInstance.SetFormatter(&logrus.TextFormatter{})
|
|
@@ -65,13 +66,14 @@ func initBinlog() {
|
|
|
// 设置日志输出JSON格式
|
|
|
jsonFormat := new(logrus.JSONFormatter)
|
|
|
jsonFormat.DisableHTMLEscape = true
|
|
|
+ jsonFormat.TimestampFormat = HlbFormatDateTime
|
|
|
Binlog.SetFormatter(jsonFormat)
|
|
|
}
|
|
|
func initApiLog() {
|
|
|
logPath := ApiLogPath
|
|
|
if logPath == "" {
|
|
|
if RunMode == "release" {
|
|
|
- logPath = `/data/rdlucklog/` + APP_NAME_EN
|
|
|
+ logPath = `/data/etalogs/` + APP_NAME_EN
|
|
|
} else {
|
|
|
logPath = `./rdlucklog/api`
|
|
|
}
|
|
@@ -90,6 +92,7 @@ func initApiLog() {
|
|
|
// 设置日志输出JSON格式
|
|
|
jsonFormat := new(logrus.JSONFormatter)
|
|
|
jsonFormat.DisableHTMLEscape = true
|
|
|
+ jsonFormat.TimestampFormat = HlbFormatDateTime
|
|
|
ApiLog.SetFormatter(jsonFormat)
|
|
|
}
|
|
|
|
|
@@ -98,9 +101,10 @@ func rolling(fLog *logrus.Logger, logFile string) {
|
|
|
// 设置输出
|
|
|
fLog.SetOutput(&lumberjack.Logger{
|
|
|
Filename: logFile, //日志文件位置
|
|
|
- MaxSize: 500, // 单文件最大容量,单位是MB
|
|
|
+ MaxSize: 100, // 单文件最大容量,单位是MB
|
|
|
MaxBackups: 3, // 最大保留过期文件个数
|
|
|
MaxAge: 7, // 保留过期文件的最大时间间隔,单位是天
|
|
|
Compress: true, // 是否需要压缩滚动日志, 使用的 gzip 压缩
|
|
|
+ LocalTime: true,
|
|
|
})
|
|
|
}
|