aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/caddyhttp.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-11-15 17:01:07 -0700
committerMatthew Holt <[email protected]>2019-11-15 17:01:07 -0700
commitaf26a03da1af7cd7d64fc03270961829d0311ed7 (patch)
tree4eb012115ecdb9b6e6358815f1780d2a2bf3af76 /modules/caddyhttp/caddyhttp.go
parent8025ad9107050649b6966277fb22b4c55fb5d501 (diff)
downloadcaddy-af26a03da1af7cd7d64fc03270961829d0311ed7.tar.gz
caddy-af26a03da1af7cd7d64fc03270961829d0311ed7.zip
http: Only enable access logs if configured
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r--modules/caddyhttp/caddyhttp.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index 36d81542f..783082801 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -76,9 +76,13 @@ func (app *App) Provision(ctx caddy.Context) error {
for srvName, srv := range app.Servers {
srv.logger = app.logger.Named("log")
- srv.accessLogger = app.logger.Named("log.access")
srv.errorLogger = app.logger.Named("log.error")
+ // only enable access logs if configured
+ if srv.Logs != nil {
+ srv.accessLogger = app.logger.Named("log.access")
+ }
+
if srv.AutoHTTPS == nil {
// avoid nil pointer dereferences
srv.AutoHTTPS = new(AutoHTTPSConfig)