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:
parent
7cf221f767
commit
552320bae2
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue