No process/application logs to understand problems - how to enable?

Hi,

I’ve been using caddy as a lightweight replacement for nginx and really liking the simplicity apart from one annoying thing: the complete lack of feedback!

I just tried to implement the filemanager plugin and it just fails on boot, no error, no log, nothing helpful and I have no idea what’s wrong. I have no idea if this is a problem with my config syntax, my system, the application itself, my letsencrypt account.

Is there a way to enable useful error messages? If so, it should be on by default. I don’t want to spend hours doing trial and error…

The setup is a fresh Ubuntu 16 with a default systemd, installed caddy by the systemd readme, everything else works fine it’s just the fact that it’s not telling me what’s wrong when something goes wrong.

Hi @Southclaws, welcome to the Caddy community!

I think the -log command line flag is what you’re looking for.

https://caddyserver.com/docs/cli#log

You mention systemd - if you’re using the example unit file from the Caddy repo on Github, it’s already logging to stdout, but it’s being captured by the system logger. You want to check journalctl or service caddy status, from memory.

You might also find the log and errors directives useful, but they pertain to access and errors specific to serving HTTP, not startup.

https://caddyserver.com/docs/log
https://caddyserver.com/docs/errors

1 Like

I have that flag already set, I just followed the systemd setup guide and this is my exec line:

ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp

However, when I boot the service with my filemanager block uncommented, I just get this from journalctl:

Oct 02 19:58:06 southclaws systemd[1]: Started Caddy HTTP/2 web server.
Oct 02 19:58:06 southclaws systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Oct 02 19:58:06 southclaws systemd[1]: caddy.service: Unit entered failed state.
Oct 02 19:58:06 southclaws systemd[1]: caddy.service: Failed with result 'exit-code'.
Oct 02 19:58:07 southclaws systemd[1]: caddy.service: Service hold-off time over, scheduling restart.
Oct 02 19:58:07 southclaws systemd[1]: Stopped Caddy HTTP/2 web server.
Oct 02 19:58:07 southclaws systemd[1]: caddy.service: Start request repeated too quickly.
Oct 02 19:58:07 southclaws systemd[1]: Failed to start Caddy HTTP/2 web server.

As far as I can see, there’s no output from the actual Caddy process there, just systemd stuff.

The full unit file I used is here: https://github.com/mholt/caddy/tree/master/dist/init/linux-systemd

If I can get some output as to what’s wrong with my config, it would definitely help debug exactly what the issue is with it.

Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.