1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-29 03:20:33 +00:00

add error logging guide section

This commit is contained in:
Nikolay Kim 2018-01-20 20:21:01 -08:00
parent 7cf221f767
commit 552320bae2

View file

@ -134,3 +134,18 @@ fn index(req: HttpRequest) -> Result<&'static str> {
```
In this example *BAD REQUEST* response get generated for `MyError` error.
## Error logging
Actix logs all errors with `WARN` log level. If log level set to `DEBUG`
and `RUST_BACKTRACE` is enabled, backtrace get logged. The Error type uses
cause's error backtrace if available, if the underlying failure does not provide
a backtrace, a new backtrace is constructed pointing to that conversion point
(rather than the origin of the error). This construction only happens if there
is no underlying backtrace; if it does have a backtrace no new backtrace is constructed.
You can enable backtrace and debug logging with following command:
```
>> RUST_BACKTRACE=1 RUST_LOG=actix_web=debug cargo run
```