From 7198dde4654ca02c2e085cde46d5b5f3cedd54b4 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 20 Feb 2018 12:49:42 -0800 Subject: [PATCH] add logger info --- guide/src/qs_10.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/guide/src/qs_10.md b/guide/src/qs_10.md index b3c5a8e06..ed36140c7 100644 --- a/guide/src/qs_10.md +++ b/guide/src/qs_10.md @@ -64,7 +64,9 @@ Active provides several useful middlewares, like *logging*, *user sessions*, etc Logging is implemented as middleware. It is common to register logging middleware as first middleware for application. -Logging middleware has to be registered for each application. +Logging middleware has to be registered for each application. *Logger* middleware +uses standard log crate to log information. You should enable logger for *actix_web* +package to see access log. ([env_logger](https://docs.rs/env_logger/*/env_logger/) or similar) ### Usage @@ -76,10 +78,14 @@ Default `Logger` could be created with `default` method, it uses the default for ``` ```rust # extern crate actix_web; +extern crate env_logger; use actix_web::Application; use actix_web::middleware::Logger; fn main() { + std::env::set_var("RUST_LOG", "actix_web=info"); + env_logger::init(); + Application::new() .middleware(Logger::default()) .middleware(Logger::new("%a %{User-Agent}i"))