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:
+1
-1
@@ -20,7 +20,7 @@ rand = "0.5"
|
||||
serde = "1"
|
||||
serde_derive = "1"
|
||||
siphasher = "0.2"
|
||||
slog = { version = "~2.3", features = ["max_level_trace", "release_max_level_trace"] }
|
||||
log = "0.4"
|
||||
chrono = "0.4.4"
|
||||
|
||||
grin_keychain = { path = "../keychain" }
|
||||
|
||||
@@ -36,7 +36,7 @@ use global;
|
||||
use keychain::{self, BlindingFactor};
|
||||
use pow::{Difficulty, Proof, ProofOfWork};
|
||||
use ser::{self, PMMRable, Readable, Reader, Writeable, Writer};
|
||||
use util::{secp, static_secp_instance, LOGGER};
|
||||
use util::{secp, static_secp_instance};
|
||||
|
||||
/// Errors thrown by Block validation
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Fail)]
|
||||
@@ -425,12 +425,7 @@ impl Block {
|
||||
/// Note: caller must validate the block themselves, we do not validate it
|
||||
/// here.
|
||||
pub fn hydrate_from(cb: CompactBlock, txs: Vec<Transaction>) -> Result<Block, Error> {
|
||||
trace!(
|
||||
LOGGER,
|
||||
"block: hydrate_from: {}, {} txs",
|
||||
cb.hash(),
|
||||
txs.len(),
|
||||
);
|
||||
trace!("block: hydrate_from: {}, {} txs", cb.hash(), txs.len(),);
|
||||
|
||||
let header = cb.header.clone();
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ use core::merkle_proof::MerkleProof;
|
||||
use core::pmmr::{Backend, ReadonlyPMMR};
|
||||
use core::BlockHeader;
|
||||
use ser::{PMMRIndexHashable, PMMRable};
|
||||
use util::LOGGER;
|
||||
|
||||
/// 64 bits all ones: 0b11111111...1
|
||||
const ALL_ONES: u64 = u64::MAX;
|
||||
@@ -137,7 +136,7 @@ where
|
||||
|
||||
/// Build a Merkle proof for the element at the given position.
|
||||
pub fn merkle_proof(&self, pos: u64) -> Result<MerkleProof, String> {
|
||||
debug!(LOGGER, "merkle_proof {}, last_pos {}", pos, self.last_pos);
|
||||
debug!("merkle_proof {}, last_pos {}", pos, self.last_pos);
|
||||
|
||||
// check this pos is actually a leaf in the MMR
|
||||
if !is_leaf(pos) {
|
||||
@@ -384,14 +383,14 @@ where
|
||||
None => hashes.push_str(&format!("{:>8} ", "??")),
|
||||
}
|
||||
}
|
||||
trace!(LOGGER, "{}", idx);
|
||||
trace!(LOGGER, "{}", hashes);
|
||||
trace!("{}", idx);
|
||||
trace!("{}", hashes);
|
||||
}
|
||||
}
|
||||
|
||||
/// Prints PMMR statistics to the logs, used for debugging.
|
||||
pub fn dump_stats(&self) {
|
||||
debug!(LOGGER, "pmmr: unpruned - {}", self.unpruned_size());
|
||||
debug!("pmmr: unpruned - {}", self.unpruned_size());
|
||||
self.backend.dump_stats();
|
||||
}
|
||||
|
||||
@@ -418,8 +417,8 @@ where
|
||||
None => hashes.push_str(&format!("{:>8} ", " .")),
|
||||
}
|
||||
}
|
||||
debug!(LOGGER, "{}", idx);
|
||||
debug!(LOGGER, "{}", hashes);
|
||||
debug!("{}", idx);
|
||||
debug!("{}", hashes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ use lru_cache::LruCache;
|
||||
|
||||
use core::hash::{Hash, Hashed};
|
||||
use core::{Output, TxKernel};
|
||||
use util::LOGGER;
|
||||
|
||||
/// Verifier cache for caching expensive verification results.
|
||||
/// Specifically the following -
|
||||
@@ -72,7 +71,6 @@ impl VerifierCache for LruVerifierCache {
|
||||
}).cloned()
|
||||
.collect::<Vec<_>>();
|
||||
debug!(
|
||||
LOGGER,
|
||||
"lru_verifier_cache: kernel sigs: {}, not cached (must verify): {}",
|
||||
kernels.len(),
|
||||
res.len()
|
||||
@@ -91,7 +89,6 @@ impl VerifierCache for LruVerifierCache {
|
||||
}).cloned()
|
||||
.collect::<Vec<_>>();
|
||||
debug!(
|
||||
LOGGER,
|
||||
"lru_verifier_cache: rangeproofs: {}, not cached (must verify): {}",
|
||||
outputs.len(),
|
||||
res.len()
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ extern crate serde;
|
||||
extern crate serde_derive;
|
||||
extern crate siphasher;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate log;
|
||||
extern crate chrono;
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
|
||||
Reference in New Issue
Block a user