mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
Use rotating log files
This commit is contained in:
parent
04c7c442c5
commit
dc63e50172
1 changed files with 7 additions and 5 deletions
12
main.go
12
main.go
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/mholt/caddy/caddy"
|
||||
"github.com/mholt/caddy/caddy/https"
|
||||
"github.com/xenolf/lego/acme"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -65,11 +66,12 @@ func main() {
|
|||
case "":
|
||||
log.SetOutput(ioutil.Discard)
|
||||
default:
|
||||
file, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Error opening process log file: %v", err)
|
||||
}
|
||||
log.SetOutput(file)
|
||||
log.SetOutput(&lumberjack.Logger{
|
||||
Filename: logfile,
|
||||
MaxSize: 100,
|
||||
MaxAge: 14,
|
||||
MaxBackups: 10,
|
||||
})
|
||||
}
|
||||
|
||||
if revoke != "" {
|
||||
|
|
Loading…
Reference in a new issue