I have consul running as a local DNS server for service discovery. Consul has SRV records for my service so I am using srv+ in my reverse_proxy directive so that Caddy will find the SRV record and forward to the correct host:port. I am getting a 500 response so I wanted to debug using Caddy’s logs. However, even with the log directive caddy does not seem to be writing any log file. Does anyone know how to debug Caddy itself not writing a log file?
4. Error messages and/or full log output:
5. What I already tried:
I thought maybe caddy does not have permission to write the log file so instead of /var/log/caddy.log I changed it to my home directory /home/ubuntu/caddy.log however still no log file is being written.
Apparently you are correct.
The problem must have been related to the unstable Caddy instance I had due to loading invalid Caddyfiles prior to adding the log entry. I just added a log entry to my Caddyfile and reloaded and it worked.
I was able to debug using systemctl status caddy and saw this can't open new logfile: open /home/ubuntu/caddy.log: permission denied. So I made that file and opened up it’s permissions and that worked.