Logs
Tracing or logging in Shuttle apps.
Shuttle records build logs and anything your application writes to stdout
and stderr
.
Viewing Logs
To view the logs for your current active deployment, if there is one:
You can also view logs of a specific deployment by adding the deployment id to this command:
To get the deployment ID, you can run this command to view your deployment history:
The --latest
or -l
flag will get the logs from the most recently created deployment:
To view logs without the timestamps and log origin tags:
Default Tracing Subscriber
By default, Shuttle will set up a global tracing subscriber behind the scenes.
If you’d rather set up your own tracing or logging, you can opt-out by disabling the default features on shuttle-runtime
:
With the default features enabled you can skip the step of initializing your subscriber when implementing tracing
in your application, all you have to do is add tracing
as a dependency in your Cargo.toml
, and you’re good to go!
If you’d rather use log, everything from the above section on tracing applies.
A log-compatible layer is added to the global subscriber, so like with tracing, all you need to do to use log
macros
in your project is add it to your Cargo.toml
.
Configuring the default subscriber
The global subscriber has an env_filter
which defaults to the INFO
log level if no RUST_LOG
variable is set.
You can change the log level for local runs with RUST_LOG="..." shuttle run
or shuttle run --debug
.
Deployments use RUST_LOG="info"
, and this is not configurable at the moment. A custom subscriber can be set up instead.
Custom logging setup
If you opt-out of the default subscriber, you can set up logging or tracing the way you would in any other Rust application.
The only thing you need to ensure is that your setup writes to stdout
, as this is what Shuttle will record and return from
the shuttle logs
commands.
We’ve created an example Actix Web app with a simple tracing
: custom tracing example.
Was this page helpful?