New logger for the Traefik logs

This commit is contained in:
Ludovic Fernandez 2022-11-21 18:36:05 +01:00 committed by GitHub
parent 27c02b5a56
commit 56f7515ecd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
297 changed files with 2337 additions and 1934 deletions

View file

@ -8,7 +8,7 @@ import (
"os/signal"
"syscall"
"github.com/traefik/traefik/v2/pkg/log"
"github.com/rs/zerolog/log"
)
func (s *Server) configureSignals() {
@ -22,17 +22,13 @@ func (s *Server) listenSignals(ctx context.Context) {
return
case sig := <-s.signals:
if sig == syscall.SIGUSR1 {
log.WithoutContext().Infof("Closing and re-opening log files for rotation: %+v", sig)
log.Info().Msgf("Closing and re-opening log files for rotation: %+v", sig)
if s.accessLoggerMiddleware != nil {
if err := s.accessLoggerMiddleware.Rotate(); err != nil {
log.WithoutContext().Errorf("Error rotating access log: %v", err)
log.Error().Err(err).Msg("Error rotating access log")
}
}
if err := log.RotateFile(); err != nil {
log.WithoutContext().Errorf("Error rotating traefik log: %v", err)
}
}
}
}