How to log to stdout and stderr

1. The problem I’m having:

I’d like to log caddy errors to stderr and caddy output to stdout, and not both to just stderr OR stdout.

3. Caddy version:

caddy:2.7.6

4. How I installed and ran Caddy:

a. System environment:

Docker

d. My complete Caddy config:

{$DOMAIN_NAME} {
	#tls {$TLS_EMAIL} {
	#	ca https://acme.sectigo.com/v2/OV
	#	eab {$EAB_KID} {$EAB_HMAC}
	#}

	# Test HTTPS setup
	#tls {$TLS_EMAIL} {
	#	ca https://acme-staging-v02.api.letsencrypt.org/directory
	#}

	# Serves static files
	root * /var/www
	file_server

	# Serves dynamic requests
	@notStatic {
		not path /static/*
	}
	reverse_proxy @notStatic django:8000

	encode zstd gzip

	log {
		output stdout
	}
}

The log directive inside a site block only configures access logs (i.e. simple request logging).

To configure the rest of the logs, you need to use the log global option (in the global options block), in which case you can make two loggers with different log levels. I don’t think it’s possible to set a maximum log level though, only a minimum (which defaults to INFO). Maybe we should add that at some point.