Skip to content

cwp logs

shipped 1.0.0
cwp logs [env] [flags]

Acts on the local site unless an environment is named.

A conduit: standard output belongs to the program being run, so there is no --json and the exit code is forwarded unchanged.

ArgumentWhat it isDefault
[env]environment to read (omit for the local site)
FlagWhat it doesDefault
-f, --followstream until interruptedoff
--lines <n>how many lines of history to print

Plus the shared flags --verbose and --dry-run.

What it does

Tails the logs: ddev logs locally, and the environment’s own log remotely — cloudron logs on Cloudron, and WordPress’s wp-content/debug.log on a plain host, which is the only log such a host is guaranteed to have.

The two flag names are cwp’s own, and that is the point of the command. The tools underneath disagree, and one spelling means opposite things:

followline count
ddev logs-f, --follow--tail <n>
cloudron logs-f, --tail-l, --lines <n>
tail over ssh-f-n <n>

A --tail 50 typed from memory prints fifty lines locally and starts following production remotely. cwp logs -f and cwp logs --lines <n> each mean one thing, and cwp maps them to whichever spelling each tool wants.

Interrupting a follow exits 130 — the shell’s convention for SIGINT — not 1. Stopping -f is how the command ends, not a failure.

Example

cwp logs                    # the local web container
cwp logs --lines 50         # the last fifty local lines
cwp logs prod -f            # follow production

What it does not do

It does not read the server’s logs. cloudron logs --system is about the machine; this command is about your project, so only the app’s own logs are in scope.

There is no --json: the output belongs to the tool underneath, and -f never terminates on its own, so there would be no envelope to close.