Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update log4rs for tari_stratum_transcoder #3182

Merged
merged 2 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/tari_stratum_transcoder/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use tari_core::blocks::{Block, NewBlockTemplate};
use tari_utilities::{hex::Hex, message_format::MessageFormat};
use tracing::{debug, error};

const LOG_TARGET: &str = "tari_stratum_proxy::proxy";
const LOG_TARGET: &str = "tari_stratum_transcoder::transcoder";

#[derive(Debug, Clone)]
pub struct StratumTranscoderProxyConfig {
Expand Down
44 changes: 44 additions & 0 deletions common/logging/log4rs_sample_transcoder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# A sample log configuration file for running in release mode. By default, this configuration splits up log messages to
# three destinations:
# * Console: For log messages with level INFO and higher
# * log/transcoder/transcoder.log: All transcoder logs will be written to this file
#
# See https://docs.rs/log4rs/0.8.3/log4rs/encode/pattern/index.html for deciphering the log pattern. The log format
# used in this sample configuration prints messages as:
# timestamp [target] LEVEL message
refresh_rate: 30 seconds
appenders:
# An appender named "transcoder" that writes to a file with a custom pattern encoder
transcoder:
kind: rolling_file
path: "log/transcoder/transcoder.log"
policy:
kind: compound
trigger:
kind: size
limit: 200mb
roller:
kind: fixed_window
base: 1
count: 50
pattern: "log/transcoder/transcoder.{}.log"
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

# root (to transcoder)
root:
level: debug
appenders:
- transcoder

loggers:
h2:
level: info
appenders:
- transcoder
additive: false
hyper:
level: info
appenders:
- transcoder
additive: false
4 changes: 2 additions & 2 deletions common/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ pub fn install_default_merge_mining_proxy_logfile_config(path: &Path) -> Result<
file.write_all(source.as_ref())
}

/// Installs a new default logfile configuration, copied from `log4rs_sample_proxy.yml` to the given path.
/// Installs a new default logfile configuration, copied from `log4rs_sample_transcoder.yml` to the given path.
pub fn install_default_stratum_transcoder_logfile_config(path: &Path) -> Result<(), std::io::Error> {
let source = include_str!("../logging/log4rs_sample_proxy.yml");
let source = include_str!("../logging/log4rs_sample_transcoder.yml");
if let Some(d) = path.parent() {
fs::create_dir_all(d)?
};
Expand Down