How to display Caddy Docker Logs in Console Format

1. Caddy version (caddy version):

2.4.1

2. How I run Caddy:

a. System environment:

Host - Ubuntu 20.04.2 LTS
Docker Desktop version - 20.10.6
Caddy container - caddy:latest

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: '3.8'
services:
  caddy:
    image: xcaddy:latest
    container_name: caddy
    ports:
      - 80:80
      - 443:443
    networks:
      - wg-pia
    environment:
      - TZ=America/Chicago
      - PUID=1000
      - PGID=1000
      - CADDY_DOCKER_CADDYFILE_PATH=/data/CaddyFile
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - "${docker}/caddy2/data:/data"
      - "${docker}/caddy2/config:/config"
    labels:
      - com.centurylinklabs.watchtower.enable=false

d. My complete Caddyfile or JSON config:

{
	https_port	443
	http_port	80
	debug
	log {
		format console
	}
}

3. The problem I’m having:

The container logs are displayed in json rather than console format.

4. Error messages and/or full log output:

There are no error messages present in the container logs. They are just being displayed in json instead of console format.

5. What I already tried:

Searched the docs and the formum and I think I am using the correct syntax in the Caddyfile global block based on what I have read. Copied verbatim from the docs, but does not seem to be working for me. Guessing I am not understanding the docs correctly.

6. Links to relevant resources:

The console format still contains JSON, because logs are structured in Caddy.

This topic was automatically closed after 30 days. New replies are no longer allowed.