From 552320bae265f3bcd96a5d6a92b7091579b7ab63 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 20 Jan 2018 20:21:01 -0800 Subject: [PATCH] add error logging guide section --- guide/src/qs_4_5.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/guide/src/qs_4_5.md b/guide/src/qs_4_5.md index dcdea3fe5..5a11af733 100644 --- a/guide/src/qs_4_5.md +++ b/guide/src/qs_4_5.md @@ -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 +```