Caddy start logs

When running caddy as a service (or via caddy start), how can I see the logs shown with caddy run?

Example caddy run output:

journalctl -u caddy -f doesn’t have it, and the -log flag was removed in v2.

Edit: sorry, it seems journalctl does contain the logs when caddy is ran as a service. However, is there a way I can get the logs when caddy is run with caddy start?

Please fill out the template which you deleted. We can only answer your queries given those crucial data points.

Thanks for the reply @Mohammed90!

This was a general question, not specific to any configuration or system. Just a CLI usage question (how to get the logs for the caddy process, not access logs).

(made a small edit to the post)

in the docs you can see how to get Caddy logs when running as a service:

3 Likes

Thanks @Pablo, yeah, sorry, I realized my mistake and edited my original post.

However, it seems like there’s no way to get logs with caddy start?

No. It’s strongly recommended you run Caddy with caddy run for anything other than spinning up a simple temporary server. The caddy start command doesn’t really offer much in terms of reliability; it won’t start back up when your machine restarts, etc. It’s best to run Caddy as a service with caddy run, and let the service manager (systemd in your case I assume, since you mentioned journalctl) deal with keeping it running.

As @plorenzo wrote, see the docs for the recommended command to run to see Caddy’s logs, without truncation (by default journalctl truncates long lines, which is problematic with Caddy because lines are usually pretty long and full of contextual info).

2 Likes

That depends on what in your configuration file (Caddyfile or otherwise). The command caddy start forks off another process into the background. If you didn’t customize logging, then it’ll send the logs to stderr of its respective process. If you used caddy start, then you’ll need to find the forked process and capture its stderr buffer for logs. This is why we need to know what’s in your config and how you’re running caddy to give direct answer.

2 Likes

Depends. If you fill out the help template, we’d know the answer because we’d know how you are configuring Caddy, etc. By default, caddy start writes logs to stderr just like any other run of Caddy.

Also, just FYI we have a rule that text must be posted as text, not images, so we can more effectively help you: FAQ - Caddy Community

Yes; we’d be able to help in your particular case if you’d fill out the help template

We still need the help template filled out.

caddy start is useful mainly in quick dev situations where you don’t need logs, but logs are emitted. You will see them in your terminal when you run caddy start.

If you aren’t seeing any logs, then there’s more information that would be in the help template that you deleted.

2 Likes

Thanks for all the help! So I probably didn’t see the logs for the simple reason that after running start I logged out then logged in. :sweat_smile:

1 Like