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:
@@ -25,7 +25,6 @@ use core::core::hash::Hashed;
|
||||
use core::core::pmmr;
|
||||
use core::core::BlockHeader;
|
||||
use prune_list::PruneList;
|
||||
use util::LOGGER;
|
||||
|
||||
/// Compact (roaring) bitmap representing the set of positions of
|
||||
/// leaves that are currently unpruned in the MMR.
|
||||
@@ -64,7 +63,7 @@ impl LeafSet {
|
||||
let cp_file_path = Path::new(&cp_path);
|
||||
|
||||
if !cp_file_path.exists() {
|
||||
debug!(LOGGER, "leaf_set: rewound leaf file not found: {}", cp_path);
|
||||
debug!("leaf_set: rewound leaf file not found: {}", cp_path);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -73,10 +72,7 @@ impl LeafSet {
|
||||
bitmap_file.read_to_end(&mut buffer)?;
|
||||
let bitmap = Bitmap::deserialize(&buffer);
|
||||
|
||||
debug!(
|
||||
LOGGER,
|
||||
"leaf_set: copying rewound file {} to {}", cp_path, path
|
||||
);
|
||||
debug!("leaf_set: copying rewound file {} to {}", cp_path, path);
|
||||
|
||||
let mut leaf_set = LeafSet {
|
||||
path: path.clone(),
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ extern crate lmdb_zero;
|
||||
extern crate memmap;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate log;
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
|
||||
+4
-6
@@ -24,7 +24,6 @@ use core::ser::{self, PMMRable};
|
||||
use leaf_set::LeafSet;
|
||||
use prune_list::PruneList;
|
||||
use types::{prune_noop, AppendOnlyFile, HashFile};
|
||||
use util::LOGGER;
|
||||
|
||||
const PMMR_HASH_FILE: &'static str = "pmmr_hash.bin";
|
||||
const PMMR_DATA_FILE: &'static str = "pmmr_data.bin";
|
||||
@@ -103,8 +102,8 @@ where
|
||||
Ok(h) => Some(h),
|
||||
Err(e) => {
|
||||
error!(
|
||||
LOGGER,
|
||||
"Corrupted storage, could not read an entry from hash store: {:?}", e
|
||||
"Corrupted storage, could not read an entry from hash store: {:?}",
|
||||
e
|
||||
);
|
||||
return None;
|
||||
}
|
||||
@@ -126,8 +125,8 @@ where
|
||||
Ok(h) => Some(h),
|
||||
Err(e) => {
|
||||
error!(
|
||||
LOGGER,
|
||||
"Corrupted storage, could not read an entry from data store: {:?}", e
|
||||
"Corrupted storage, could not read an entry from data store: {:?}",
|
||||
e
|
||||
);
|
||||
return None;
|
||||
}
|
||||
@@ -200,7 +199,6 @@ where
|
||||
|
||||
fn dump_stats(&self) {
|
||||
debug!(
|
||||
LOGGER,
|
||||
"pmmr backend: unpruned: {}, hashes: {}, data: {}, leaf_set: {}, prune_list: {}",
|
||||
self.unpruned_size().unwrap_or(0),
|
||||
self.hash_size().unwrap_or(0),
|
||||
|
||||
@@ -29,8 +29,6 @@ use croaring::Bitmap;
|
||||
|
||||
use core::core::pmmr::{bintree_postorder_height, family, path};
|
||||
|
||||
use util::LOGGER;
|
||||
|
||||
/// Maintains a list of previously pruned nodes in PMMR, compacting the list as
|
||||
/// parents get pruned and allowing checking whether a leaf is pruned. Given
|
||||
/// a node's position, computes how much it should get shifted given the
|
||||
@@ -91,7 +89,7 @@ impl PruneList {
|
||||
prune_list.init_caches();
|
||||
|
||||
if !prune_list.bitmap.is_empty() {
|
||||
debug!(LOGGER, "prune_list: bitmap {} pos ({} bytes), pruned_cache {} pos ({} bytes), shift_cache {}, leaf_shift_cache {}",
|
||||
debug!("prune_list: bitmap {} pos ({} bytes), pruned_cache {} pos ({} bytes), shift_cache {}, leaf_shift_cache {}",
|
||||
prune_list.bitmap.cardinality(),
|
||||
prune_list.bitmap.get_serialized_size_in_bytes(),
|
||||
prune_list.pruned_cache.cardinality(),
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ use libc::{ftruncate64, off64_t};
|
||||
|
||||
use core::core::hash::Hash;
|
||||
use core::ser;
|
||||
use util::LOGGER;
|
||||
|
||||
/// A no-op function for doing nothing with some pruned data.
|
||||
pub fn prune_noop(_pruned_data: &[u8]) {}
|
||||
@@ -65,8 +64,8 @@ impl HashFile {
|
||||
Ok(h) => Some(h),
|
||||
Err(e) => {
|
||||
error!(
|
||||
LOGGER,
|
||||
"Corrupted storage, could not read an entry from hash file: {:?}", e
|
||||
"Corrupted storage, could not read an entry from hash file: {:?}",
|
||||
e
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user