Skip to content

cwp logs

shipped 1.0.0
cwp logs [env] [flags]

This name is an alias. The work moved to cwp tail, and that page documents it. This spelling still runs for one minor cycle.

Acts on the local site. Name an environment to act there instead.

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

ArgumentWhat it isDefault
[env]environment to read (default: default_environment in cwp.yml)
FlagWhat it doesDefault
-f, --followstream until interruptedoff
--lines <n>how many lines of history to print

Plus the shared flags -v, --verbose, -q, --quiet and --dry-run.

What it does

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

The two flag names are cwp’s own, and the command exists for them. 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.