Replace logging backend to log4rs and add log rotation (#1789)
* Replace logging backend to flexi-logger and add log rotation * Changed flexi_logger to log4rs * Disable logging level filtering in Root logger * Support different logging levels for file and stdout * Don't log messages from modules other than Grin-related * Fix formatting * Place backed up compressed log copies into log file directory * Increase default log file size to 16 MiB * Add comment to config file on log_max_size option
This commit is contained in:
@@ -37,7 +37,7 @@ use std::sync::Arc;
|
||||
use url::form_urlencoded;
|
||||
use util::secp::pedersen;
|
||||
use util::Mutex;
|
||||
use util::{to_base64, LOGGER};
|
||||
use util::to_base64;
|
||||
|
||||
/// Instantiate wallet Owner API for a single-use (command line) call
|
||||
/// Return a function containing a loaded API context to call
|
||||
@@ -95,7 +95,7 @@ where
|
||||
.map_err(|_| ErrorKind::GenericError("Router failed to add route".to_string()))?;
|
||||
|
||||
let mut apis = ApiServer::new();
|
||||
info!(LOGGER, "Starting HTTP Owner API server at {}.", addr);
|
||||
info!("Starting HTTP Owner API server at {}.", addr);
|
||||
let socket_addr: SocketAddr = addr.parse().expect("unable to parse socket address");
|
||||
let api_thread =
|
||||
apis.start(socket_addr, router, tls_config)
|
||||
@@ -127,7 +127,7 @@ where
|
||||
.map_err(|_| ErrorKind::GenericError("Router failed to add route".to_string()))?;
|
||||
|
||||
let mut apis = ApiServer::new();
|
||||
info!(LOGGER, "Starting HTTP Foreign API server at {}.", addr);
|
||||
info!("Starting HTTP Foreign API server at {}.", addr);
|
||||
let socket_addr: SocketAddr = addr.parse().expect("unable to parse socket address");
|
||||
let api_thread =
|
||||
apis.start(socket_addr, router, tls_config)
|
||||
@@ -226,12 +226,12 @@ where
|
||||
Ok(id) => match api.dump_stored_tx(id, false, "") {
|
||||
Ok(tx) => Ok(tx),
|
||||
Err(e) => {
|
||||
error!(LOGGER, "dump_stored_tx: failed with error: {}", e);
|
||||
error!("dump_stored_tx: failed with error: {}", e);
|
||||
Err(e)
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!(LOGGER, "dump_stored_tx: could not parse id: {}", e);
|
||||
error!("dump_stored_tx: could not parse id: {}", e);
|
||||
Err(ErrorKind::TransactionDumpError(
|
||||
"dump_stored_tx: cannot dump transaction. Could not parse id in request.",
|
||||
).into())
|
||||
@@ -307,7 +307,7 @@ where
|
||||
args.selection_strategy_is_use_all,
|
||||
)
|
||||
} else {
|
||||
error!(LOGGER, "unsupported payment method: {}", args.method);
|
||||
error!("unsupported payment method: {}", args.method);
|
||||
return Err(ErrorKind::ClientCallback("unsupported payment method"))?;
|
||||
}
|
||||
}))
|
||||
@@ -322,7 +322,7 @@ where
|
||||
parse_body(req).and_then(move |mut slate| match api.finalize_tx(&mut slate) {
|
||||
Ok(_) => ok(slate.clone()),
|
||||
Err(e) => {
|
||||
error!(LOGGER, "finalize_tx: failed with error: {}", e);
|
||||
error!("finalize_tx: failed with error: {}", e);
|
||||
err(e)
|
||||
}
|
||||
}),
|
||||
@@ -340,12 +340,12 @@ where
|
||||
Ok(id) => match api.cancel_tx(id) {
|
||||
Ok(_) => ok(()),
|
||||
Err(e) => {
|
||||
error!(LOGGER, "cancel_tx: failed with error: {}", e);
|
||||
error!("cancel_tx: failed with error: {}", e);
|
||||
err(e)
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!(LOGGER, "cancel_tx: could not parse id: {}", e);
|
||||
error!("cancel_tx: could not parse id: {}", e);
|
||||
err(ErrorKind::TransactionCancellationError(
|
||||
"cancel_tx: cannot cancel transaction. Could not parse id in request.",
|
||||
).into())
|
||||
@@ -443,7 +443,7 @@ where
|
||||
match self.handle_get_request(&req) {
|
||||
Ok(r) => Box::new(ok(r)),
|
||||
Err(e) => {
|
||||
error!(LOGGER, "Request Error: {:?}", e);
|
||||
error!("Request Error: {:?}", e);
|
||||
Box::new(ok(create_error_response(e)))
|
||||
}
|
||||
}
|
||||
@@ -454,7 +454,7 @@ where
|
||||
self.handle_post_request(req)
|
||||
.and_then(|r| ok(r))
|
||||
.or_else(|e| {
|
||||
error!(LOGGER, "Request Error: {:?}", e);
|
||||
error!("Request Error: {:?}", e);
|
||||
ok(create_error_response(e))
|
||||
}),
|
||||
)
|
||||
@@ -511,7 +511,7 @@ where
|
||||
parse_body(req).and_then(move |mut slate| match api.receive_tx(&mut slate) {
|
||||
Ok(_) => ok(slate.clone()),
|
||||
Err(e) => {
|
||||
error!(LOGGER, "receive_tx: failed with error: {}", e);
|
||||
error!("receive_tx: failed with error: {}", e);
|
||||
err(e)
|
||||
}
|
||||
}),
|
||||
@@ -548,7 +548,7 @@ where
|
||||
{
|
||||
fn post(&self, req: Request<Body>) -> ResponseFuture {
|
||||
Box::new(self.handle_request(req).and_then(|r| ok(r)).or_else(|e| {
|
||||
error!(LOGGER, "Request Error: {:?}", e);
|
||||
error!("Request Error: {:?}", e);
|
||||
ok(create_error_response(e))
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user