diff --git a/applications/tari_stratum_transcoder/src/proxy.rs b/applications/tari_stratum_transcoder/src/proxy.rs index 9bdc3b3541..6e5d508a53 100644 --- a/applications/tari_stratum_transcoder/src/proxy.rs +++ b/applications/tari_stratum_transcoder/src/proxy.rs @@ -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 { diff --git a/common/logging/log4rs_sample_transcoder.yml b/common/logging/log4rs_sample_transcoder.yml new file mode 100644 index 0000000000..70a4189b3c --- /dev/null +++ b/common/logging/log4rs_sample_transcoder.yml @@ -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 diff --git a/common/src/logging.rs b/common/src/logging.rs index 6e8e9f288b..15e4598f5d 100644 --- a/common/src/logging.rs +++ b/common/src/logging.rs @@ -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)? };