Debug logging on caddy

1. Caddy version (caddy version):

Development version from git

2. How I run Caddy:

Systemd unit provided by ubuntu package

a. System environment:

Ubuntu 20.04

b. Command:

Systemd unit provided by ubuntu

c. Service/unit/compose file:

Systemd unit provided by ubuntu

d. My complete Caddyfile or JSON config:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.
#
{
    experimental_http3
    email ******@linuxandria.com
    admin off
}

log {
    output stdout
    level debug
}

(cert) {
   tls {
        dns cloudflare *************
    }
}

linuxandria.com {
    redir https://www.linuxandria.com{uri} permanent
}

#test.linuxandria.com {
#    import cert
#    encode * gzip {
#       gzip 9
#    }
#    file_server
#    php_fastcgi unix//run/php/php7.4-fpm.sock
#    root * /var/www/test
#    reverse_proxy * localhost:2369
#    push
#}

www.linuxandria.com {
    import cert
    encode gzip zstd
    file_server
    php_fastcgi unix//run/php/php7.4-fpm.sock
    root * /var/www/html
    push
}

xyzz4.linuxandria.com {
    import cert
    encode gzip zstd
    root * /var/www/matomo
    php_fastcgi unix//run/php/php7.4-fpm.sock
    file_server
    push
}

downloads.linuxandria.com {
    import cert
    encode gzip zstd
    file_server
    php_fastcgi unix//run/php/php7.4-fpm.sock
    root * /var/www/downloads
    push
}

jenkins.linuxandria.com {
    import cert
    encode gzip zstd
    reverse_proxy 127.0.0.1:7070
}

git.linuxandria.com {
     import cert
     encode gzip zstd
     reverse_proxy * localhost:8181 {
         header_up Host {http.request.host}
         header_up X-Real-IP {http.request.remote.host}
         header_up X-Forwarded-For {http.request.remote.host}
         header_up X-Forwarded-Port {http.request.port}
         header_up X-Forwarded-Proto {http.request.scheme}
     }
}

admin.linuxandria.com {
     import cert
     encode gzip zstd
     reverse_proxy * localhost:9080
}

bw.linuxandria.com {
  import cert
  encode gzip zstd
  header / {
       Strict-Transport-Security "max-age=31536000;"
       X-XSS-Protection "1; mode=block"
       X-Frame-Options "DENY"
       X-Robots-Tag "none"
       -Server
   }
  reverse_proxy /notifications/hub/negotiate 172.18.0.2:80
  reverse_proxy /notifications/hub 172.18.0.2:3012
  reverse_proxy 172.18.0.2:80 {
       header_up X-Real-IP {remote_host}
  }
}

nc.linuxandria.com {
    import cert
    encode gzip zstd
    php_fastcgi unix//run/php/php7.4-fpm.sock
    root * /var/www/nextcloud
    encode gzip
    push
}

cdn.linuxandria.com {
     import cert
     root * /var/www/cdn
     encode gzip
     file_server
}

#zzyx5.linuxandria.com {
#     import cert
#     root * /var/www/bypass
#     encode gzip
#     file_server
#}

3. The problem I’m having:

Using the suggestions from the documentation, trying to turn on debug logs is crashing caddy.

4. Error messages and/or full log output:

N/A

5. What I already tried:

What’s in the caddyfile

6. Links to relevant resources:

The log directive only enables access logs, and it must be enabled per site.

Right now, Caddy is parsing your Caddyfile as log being a site name, which is invalid.

I think what you were looking for instead is the debug global option, which will set the log level for the default logger to DEBUG.

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