# Rocket - Logging to a file using log4rs

* Add [log4rs](https://crates.io/crates/log4rs) to the dependencies.

{% embed include file="src/examples/rocket/logging-with-log4rs-to-file/Cargo.toml" %}

* Create a configuration file:

{% embed include file="src/examples/rocket/logging-with-log4rs-to-file/log4rs.yaml)

* Initiate the logging

{% embed include file="src/examples/rocket/logging-with-log4rs-to-file/src/main.rs" %}



