mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
add error logging guide section
This commit is contained in:
parent
7cf221f767
commit
552320bae2
@ -134,3 +134,18 @@ fn index(req: HttpRequest) -> Result<&'static str> {
|
|||||||
```
|
```
|
||||||
|
|
||||||
In this example *BAD REQUEST* response get generated for `MyError` error.
|
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
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user