Default to CLF when accesslog format is unsupported
This commit is contained in:
parent
d044c0f4cc
commit
605a9b2817
2 changed files with 3 additions and 3 deletions
|
@ -26,12 +26,11 @@ accessLog: {}
|
||||||
By default access logs are written to the standard output.
|
By default access logs are written to the standard output.
|
||||||
To write the logs into a log file, use the `filePath` option.
|
To write the logs into a log file, use the `filePath` option.
|
||||||
|
|
||||||
in the Common Log Format (CLF), extended with additional fields.
|
|
||||||
|
|
||||||
### `format`
|
### `format`
|
||||||
|
|
||||||
By default, logs are written using the Common Log Format (CLF).
|
By default, logs are written using the Common Log Format (CLF).
|
||||||
To write logs in JSON, use `json` in the `format` option.
|
To write logs in JSON, use `json` in the `format` option.
|
||||||
|
If the given format is unsupported, the default (CLF) is used instead.
|
||||||
|
|
||||||
!!! note "Common Log Format"
|
!!! note "Common Log Format"
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,8 @@ func NewHandler(config *types.AccessLog) (*Handler, error) {
|
||||||
case JSONFormat:
|
case JSONFormat:
|
||||||
formatter = new(logrus.JSONFormatter)
|
formatter = new(logrus.JSONFormatter)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported access log format: %s", config.Format)
|
log.WithoutContext().Errorf("unsupported access log format: %q, defaulting to common format instead.", config.Format)
|
||||||
|
formatter = new(CommonLogFormatter)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger := &logrus.Logger{
|
logger := &logrus.Logger{
|
||||||
|
|
Loading…
Reference in a new issue