Ensure LAPI logs respect log_media
(#707)
* if log_media is set to file, don't try to log to stdout * use the log media no matter what
This commit is contained in:
parent
1f2f6c87d5
commit
6d28599efa
1 changed files with 2 additions and 2 deletions
|
@ -52,7 +52,7 @@ func NewServer(config *csconfig.LocalApiServerCfg) (*APIServer, error) {
|
|||
}
|
||||
|
||||
logFile := ""
|
||||
if config.LogDir != "" && config.LogMedia == "file" {
|
||||
if config.LogMedia == "file" {
|
||||
logFile = fmt.Sprintf("%s/crowdsec_api.log", config.LogDir)
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ func NewServer(config *csconfig.LocalApiServerCfg) (*APIServer, error) {
|
|||
if err != nil {
|
||||
return &APIServer{}, errors.Wrapf(err, "creating api access log file: %s", logFile)
|
||||
}
|
||||
gin.DefaultWriter = io.MultiWriter(file, os.Stdout)
|
||||
gin.DefaultWriter = io.MultiWriter(file)
|
||||
}
|
||||
|
||||
router.Use(gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
|
||||
|
|
Loading…
Reference in a new issue