From 3b1867613646b43b09153d13bd33102864338b5d Mon Sep 17 00:00:00 2001 From: karczuRF Date: Mon, 7 Oct 2024 09:48:34 +0200 Subject: [PATCH 1/5] refactor: logging setup --- src-tauri/Cargo.lock | 6 +- src-tauri/Cargo.toml | 10 +- src-tauri/log4rs/universe_sample.yml | 94 +++++++++++++++++++ .../wallet_daemon_sample.yml} | 33 +++++-- src-tauri/src/lib.rs | 18 +++- src-tauri/src/utils/logging_utils.rs | 30 ++++++ src-tauri/src/utils/mod.rs | 1 + src-tauri/src/wallet_daemon.rs | 18 ++-- src-tauri/tauri.conf.json | 5 +- src-tauri/wallet_daemon.log.yml | 81 ---------------- 10 files changed, 188 insertions(+), 108 deletions(-) create mode 100644 src-tauri/log4rs/universe_sample.yml rename src-tauri/{log4rs_sample.yml => log4rs/wallet_daemon_sample.yml} (73%) create mode 100644 src-tauri/src/utils/logging_utils.rs create mode 100644 src-tauri/src/utils/mod.rs delete mode 100644 src-tauri/wallet_daemon.log.yml diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 9501240..e91a4fc 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4697,9 +4697,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" dependencies = [ "serde", "value-bag", @@ -8561,10 +8561,12 @@ dependencies = [ "diesel", "diesel_migrations", "flate2", + "log", "log4rs", "semver", "serde", "serde_json", + "serde_yaml", "sha1", "sha2", "tar", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 766bfa8..18dd3b4 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -30,13 +30,7 @@ axum = "0.7.5" axum-jrpc = "0.3.2" diesel = { version = "2.1.6", features = ["sqlite", "returning_clauses_for_sqlite_3_35"] } diesel_migrations = { version = "2.1.0", features = ["sqlite"] } -log4rs = { version = "1.3", features = [ - "rolling_file_appender", - "compound_policy", - "size_trigger", - "fixed_window_roller", - "console_appender", -] } +log4rs = { version = "1.3", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller", "console_appender"] } tower-http = { version = "0.5.2", features = ["fs", "trace"] } tari_crypto = "0.20.0" flate2 = "1.0.28" @@ -56,3 +50,5 @@ sha2 = "0.10.8" sha1 = "0.10.6" thiserror = "1.0.60" semver = "1.0.23" +serde_yaml = "0.9.34" +log = "0.4.22" diff --git a/src-tauri/log4rs/universe_sample.yml b/src-tauri/log4rs/universe_sample.yml new file mode 100644 index 0000000..92e9251 --- /dev/null +++ b/src-tauri/log4rs/universe_sample.yml @@ -0,0 +1,94 @@ +# 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/base-node/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there +# are lots of P2P debug messages, and so this traffic is segregated from the application log messages +# * log/base-node/base_layer.log: Non-comms related INFO-level messages and higher are logged into this file +# * log/base-node/other.log: Third-party crates' messages will be logged here at an ERROR level +# +# 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 "stdout" that writes to stdout + stdout: + kind: console + encoder: + pattern: "{d(%H:%M)} {h({l}):5} {m}{n}" + filters: + - kind: threshold + level: info + + # An appender named "web" that writes to a file with a custom pattern encoder + web: + kind: rolling_file + path: "{{log_dir}}/universe/log/universe-web.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/universe/log/universe-web.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} " + + # An appender named "base_layer" that writes to a file with a custom pattern encoder + default: + kind: rolling_file + path: "{{log_dir}}/universe/log/universe.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/universe/log/universe.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" + + # An appender named "other" that writes to a file with a custom pattern encoder + other: + kind: rolling_file + path: "{{log_dir}}/universe/log/other.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/universe/log/other.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " + +# Set the default logging level to "info" +root: + level: info + appenders: + - other + - stdout + +loggers: + # Route log events common to every application to all appenders + tari::universe: + level: debug + appenders: + - stdout + - default + additive: false + + tari::universe::web: + level: info + appenders: + - web + additive: false diff --git a/src-tauri/log4rs_sample.yml b/src-tauri/log4rs/wallet_daemon_sample.yml similarity index 73% rename from src-tauri/log4rs_sample.yml rename to src-tauri/log4rs/wallet_daemon_sample.yml index 6143cff..a2ba8fc 100644 --- a/src-tauri/log4rs_sample.yml +++ b/src-tauri/log4rs/wallet_daemon_sample.yml @@ -23,39 +23,58 @@ appenders: # An appender named "dan_layer" that writes to a file with a custom pattern encoder dan_layer: kind: rolling_file - path: "{{log_dir}}/log/wallet-daemon/dan_layer.log" + path: "{{log_dir}}/wallet_daemon/log/dan_layer.log" policy: kind: compound trigger: kind: size - limit: 10mb + limit: 2mb roller: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/log/wallet-daemon/dan_layer.{}.log" + pattern: "{{log_dir}}/wallet_daemon/log/dan_layer.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" json_rpc: kind: rolling_file - path: "{{log_dir}}/log/wallet-daemon/json_rpc.log" + path: "{{log_dir}}/wallet_daemon/log/json_rpc.log" policy: kind: compound trigger: kind: size - limit: 10mb + limit: 2mb roller: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/log/wallet-daemon/json_rpc.{}.log" + pattern: "{{log_dir}}/wallet_daemon/log/json_rpc.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" + # An appender named "other" that writes to a file with a custom pattern encoder + other: + kind: rolling_file + path: "{{log_dir}}/wallet_daemon/log/other.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/wallet_daemon/log/other.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " + +# Set the default logging level to "info" root: - level: warn + level: info appenders: + - other - stdout loggers: diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 863d11f..9fa9d86 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,7 +1,10 @@ use constants::TAPPLETS_ASSETS_DIR; use diesel::SqliteConnection; use fs::{ get_config_file, get_data_dir, get_log_dir }; +use log4rs::config::RawConfig; +use log::info; use tapplet_server::start; +use utils::logging_utils::setup_logging; use std::{ collections::HashMap, sync::{ Arc, Mutex }, thread::sleep, time::Duration }; use tauri::{ self, Manager }; use tokio_util::sync::CancellationToken; @@ -17,6 +20,7 @@ mod interface; mod error; mod constants; mod fs; +mod utils; use commands::{ call_wallet, @@ -45,6 +49,7 @@ use commands::{ use crate::{ rpc::permission_token, wallet_daemon::start_wallet_daemon }; +const LOG_TARGET: &str = "tari::universe::main"; pub struct Tokens { auth: Mutex, permission: Mutex, @@ -75,10 +80,19 @@ fn setup_tari_universe(app: &mut tauri::App) -> Result<(), Box Result { + println!("Initializing logging according to {:?}", config_file.to_str().unwrap_or("[??]")); + + if !config_file.exists() { + if let Some(d) = config_file.parent() { + fs + ::create_dir_all(d) + .map_err(|e| { Error::msg(format!("Could not create parent directory for log file: {:?}", e)) })?; + }; + } + + let contents = default.to_string(); + + let replace_str = base_path + .to_str() + .expect("Could not replace {{log_dir}} variable from the log4rs config") + // log4rs requires the path to be in a unix format regardless of the system it's running on + .replace('\\', "/"); + + let contents = contents.replace("{{log_dir}}", &replace_str); + let mut file = File::create(config_file).map_err(|e| { + Error::msg(format!("Could not create default log file: {}", e.to_string())) + })?; + + file.write_all(contents.as_bytes()).map_err(|e| Error::msg(format!("Could not write to file: {}", e.to_string())))?; + Ok(contents) +} diff --git a/src-tauri/src/utils/mod.rs b/src-tauri/src/utils/mod.rs new file mode 100644 index 0000000..5d46e2e --- /dev/null +++ b/src-tauri/src/utils/mod.rs @@ -0,0 +1 @@ +pub mod logging_utils; diff --git a/src-tauri/src/wallet_daemon.rs b/src-tauri/src/wallet_daemon.rs index 3de8869..7e5c6e8 100644 --- a/src-tauri/src/wallet_daemon.rs +++ b/src-tauri/src/wallet_daemon.rs @@ -1,15 +1,18 @@ use std::{ fs, panic, path::PathBuf, process, net::SocketAddr, str::FromStr }; -use tari_common::{ initialize_logging, configuration::Network }; +use log::info; +use tari_common::{ configuration::Network }; use tari_dan_app_utilities::configuration::load_configuration; use tari_dan_wallet_daemon::{ cli::Cli, config::ApplicationConfig, run_tari_dan_wallet_daemon }; use tari_shutdown::Shutdown; +use crate::utils::logging_utils::setup_logging; + +const LOG_TARGET: &str = "tari::dan::wallet_daemon::json_rpc"; pub async fn start_wallet_daemon( - log_path: PathBuf, + log_dir: PathBuf, data_dir_path: PathBuf, - wallet_daemon_config_file: PathBuf, - log_config_file: PathBuf + wallet_daemon_config_file: PathBuf ) -> Result<(), anyhow::Error> { let default_hook = panic::take_hook(); panic::set_hook( @@ -19,6 +22,8 @@ pub async fn start_wallet_daemon( }) ); let wallet_daemon_config_file = wallet_daemon_config_file.to_str().unwrap().to_owned(); + let log_config_file = &log_dir.join("wallet_daemon").join("configs").join("log4rs_config_wallet.yml"); + setup_logging(&log_config_file.clone(), &log_dir.clone(), include_str!("../log4rs/wallet_daemon_sample.yml"))?; let mut cli = Cli::init(); cli.common.network = Some(Network::LocalNet); @@ -38,10 +43,7 @@ pub async fn start_wallet_daemon( let shutdown = Shutdown::new(); let shutdown_signal = shutdown.to_signal(); - if let Err(e) = initialize_logging(&log_config_file, &log_path, include_str!("../log4rs_sample.yml")) { - eprintln!("{}", e); - return Err(e.into()); - } + info!(target: LOG_TARGET, "Wallet daemon configuration completed successfully"); run_tari_dan_wallet_daemon(config, shutdown_signal).await } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 7ffec93..ec90044 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -39,6 +39,9 @@ "icons/icon.icns", "icons/icon.ico" ], - "resources": ["wallet_daemon.config.toml", "wallet_daemon.log.yml"] + "resources": [ + "wallet_daemon.config.toml", + "./log4rs/wallet_daemon_sample.yml" + ] } } diff --git a/src-tauri/wallet_daemon.log.yml b/src-tauri/wallet_daemon.log.yml deleted file mode 100644 index 6143cff..0000000 --- a/src-tauri/wallet_daemon.log.yml +++ /dev/null @@ -1,81 +0,0 @@ -# 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/validator-node/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there -# are lots of P2P debug messages, and so this traffic is segregated from the application log messages -# * log/validator-node/dan_layer.log: Non-comms related INFO-level messages and higher are logged into this file -# * log/validator-node/other.log: Third-party crates' messages will be logged here at an ERROR level -# -# 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 "stdout" that writes to stdout - stdout: - kind: console - encoder: - pattern: "{d(%H:%M)} {h({l}):5} {m}{n}" - filters: - - kind: threshold - level: info - - # An appender named "dan_layer" that writes to a file with a custom pattern encoder - dan_layer: - kind: rolling_file - path: "{{log_dir}}/log/wallet-daemon/dan_layer.log" - policy: - kind: compound - trigger: - kind: size - limit: 10mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/log/wallet-daemon/dan_layer.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" - - json_rpc: - kind: rolling_file - path: "{{log_dir}}/log/wallet-daemon/json_rpc.log" - policy: - kind: compound - trigger: - kind: size - limit: 10mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/log/wallet-daemon/json_rpc.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" - -root: - level: warn - appenders: - - stdout - -loggers: - # Route log events common to every application to all appenders - tari::dan_wallet_daemon: - level: info - appenders: - - dan_layer - - stdout - additive: false - - tari::dan: - level: info - appenders: - - dan_layer - - stdout - additive: false - - tari::dan::wallet_daemon::json_rpc: - level: debug - appenders: - - json_rpc - additive: true From e29835409750d2fb802e14b14abc4e9661d2169f Mon Sep 17 00:00:00 2001 From: karczuRF Date: Mon, 7 Oct 2024 13:28:56 +0200 Subject: [PATCH 2/5] feat: add tapplet logging setup --- src-tauri/log4rs/tapplet_sample.yml | 71 +++++++++++++++++++++++++++++ src-tauri/src/lib.rs | 8 ++-- src-tauri/src/tapplet_server.rs | 12 +++++ 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 src-tauri/log4rs/tapplet_sample.yml diff --git a/src-tauri/log4rs/tapplet_sample.yml b/src-tauri/log4rs/tapplet_sample.yml new file mode 100644 index 0000000..ea6dfe1 --- /dev/null +++ b/src-tauri/log4rs/tapplet_sample.yml @@ -0,0 +1,71 @@ +# 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/base-node/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there +# are lots of P2P debug messages, and so this traffic is segregated from the application log messages +# * log/base-node/base_layer.log: Non-comms related INFO-level messages and higher are logged into this file +# * log/base-node/other.log: Third-party crates' messages will be logged here at an ERROR level +# +# 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 "stdout" that writes to stdout + stdout: + kind: console + encoder: + pattern: "{d(%H:%M)} {h({l}):5} {m}{n}" + filters: + - kind: threshold + level: info + + # An appender named "base_layer" that writes to a file with a custom pattern encoder + default: + kind: rolling_file + path: "{{log_dir}}/tapplet/log/tapplet.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/tapplet/log/tapplet.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" + + # An appender named "other" that writes to a file with a custom pattern encoder + other: + kind: rolling_file + path: "{{log_dir}}/tapplet/log/other.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/tapplet/log/other.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " + +# Set the default logging level to "info" +root: + level: info + appenders: + - other + - stdout + +loggers: + # Route log events common to every application to all appenders + tari::tapplet: + level: debug + appenders: + - stdout + - default + additive: false diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 9fa9d86..158017d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -3,7 +3,7 @@ use diesel::SqliteConnection; use fs::{ get_config_file, get_data_dir, get_log_dir }; use log4rs::config::RawConfig; use log::info; -use tapplet_server::start; +use tapplet_server::{ setup_log, start }; use utils::logging_utils::setup_logging; use std::{ collections::HashMap, sync::{ Arc, Mutex }, thread::sleep, time::Duration }; use tauri::{ self, Manager }; @@ -79,13 +79,13 @@ async fn try_get_tokens() -> (String, String) { fn setup_tari_universe(app: &mut tauri::App) -> Result<(), Box> { let data_dir_path = get_data_dir(app)?; let log_path = get_log_dir(app)?; + let log_tapp_dir = log_path.clone(); let wallet_daemon_config_file = get_config_file(app, "wallet_daemon.config.toml")?; // let log_config_file = get_config_file(app, "../log4rs/wallet_daemon.log.yml")?; // setup universe logging let log_config_file = &log_path.join("universe").join("configs").join("log4rs_config_universe.yml"); - let contents = setup_logging(&log_config_file.clone(), &log_path, include_str!("../log4rs/universe_sample.yml"))?; - + let contents = setup_logging(&log_config_file, &log_path, include_str!("../log4rs/universe_sample.yml"))?; let config: RawConfig = serde_yaml ::from_str(&contents) .expect("Could not parse the contents of the log file as yaml"); @@ -111,9 +111,11 @@ fn setup_tari_universe(app: &mut tauri::App) -> Result<(), Box Result<(String, CancellationToken), Error> { serve(using_serve_dir(tapplet_path), 0).await @@ -31,6 +34,8 @@ pub async fn serve(app: Router, port: u16) -> Result<(String, CancellationToken) ::serve(listener, app) .with_graceful_shutdown(shutdown_signal(cancel_token_clone)).await .map_err(|_| TappletServerError(FailedToStart)) }); + info!(target: LOG_TARGET, "Tapplet start process completed successfully"); + Ok((address, cancel_token)) } @@ -39,3 +44,10 @@ async fn shutdown_signal(cancel_token: CancellationToken) { _ = cancel_token.cancelled() => {} } } + +pub async fn setup_log(log_dir: PathBuf) -> Result<(), anyhow::Error> { + // setup universe logging + let log_config_file = &log_dir.join("tapplet").join("configs").join("log4rs_config_tapplet.yml"); + let _contents = setup_logging(&log_config_file, &log_dir, include_str!("../log4rs/tapplet_sample.yml"))?; + Ok(()) +} From 90c6207de6d72739a1ca36f7590427b2cbeaf8c9 Mon Sep 17 00:00:00 2001 From: karczuRF Date: Tue, 8 Oct 2024 10:55:38 +0200 Subject: [PATCH 3/5] wip: move configs to single yml --- src-tauri/log4rs/tapplet_sample.yml | 7 +- src-tauri/log4rs/universe_sample.yml | 135 +++++++++++++++++++--- src-tauri/log4rs/wallet_daemon_sample.yml | 33 ++++-- src-tauri/src/wallet_daemon.rs | 13 ++- 4 files changed, 157 insertions(+), 31 deletions(-) diff --git a/src-tauri/log4rs/tapplet_sample.yml b/src-tauri/log4rs/tapplet_sample.yml index ea6dfe1..168d140 100644 --- a/src-tauri/log4rs/tapplet_sample.yml +++ b/src-tauri/log4rs/tapplet_sample.yml @@ -1,7 +1,7 @@ # 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/base-node/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there +# * log/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there # are lots of P2P debug messages, and so this traffic is segregated from the application log messages # * log/base-node/base_layer.log: Non-comms related INFO-level messages and higher are logged into this file # * log/base-node/other.log: Third-party crates' messages will be logged here at an ERROR level @@ -20,8 +20,8 @@ appenders: - kind: threshold level: info - # An appender named "base_layer" that writes to a file with a custom pattern encoder - default: + # An appender named "tapplet" that writes to a file with a custom pattern encoder + tapplet: kind: rolling_file path: "{{log_dir}}/tapplet/log/tapplet.log" policy: @@ -67,5 +67,4 @@ loggers: level: debug appenders: - stdout - - default additive: false diff --git a/src-tauri/log4rs/universe_sample.yml b/src-tauri/log4rs/universe_sample.yml index 92e9251..ce51e4d 100644 --- a/src-tauri/log4rs/universe_sample.yml +++ b/src-tauri/log4rs/universe_sample.yml @@ -1,10 +1,17 @@ # A sample log configuration file for running in release mode. By default, this configuration splits up log messages to -# three destinations: +# the following destinations: # * Console: For log messages with level INFO and higher -# * log/base-node/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there -# are lots of P2P debug messages, and so this traffic is segregated from the application log messages -# * log/base-node/base_layer.log: Non-comms related INFO-level messages and higher are logged into this file -# * log/base-node/other.log: Third-party crates' messages will be logged here at an ERROR level +# * logs/universe: INFO-level logs related to the Tari Universe. This file will be quite busy, so logs are splited: +# logs/universe/universe.log +# logs/universe/universe-web.log +# logs/universe/other.log +# * logs/wallet_daemon: INFO-level logs related to the wallet daemon. This file will be quite busy, so logs are splited: +# logs/wallet_daemon/wallet_daemon.log +# logs/wallet_daemon/dan-layer.log +# logs/wallet_daemon/jason-rpc.log +# * logs/tapplet: INFO-level logs related to the active tapplet. At the moment only single file is created: +# logs/tapplet/tapplet.log +# # # 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: @@ -20,10 +27,10 @@ appenders: - kind: threshold level: info - # An appender named "web" that writes to a file with a custom pattern encoder - web: + # An appender named "default" that writes to a file with a custom pattern encoder + default: kind: rolling_file - path: "{{log_dir}}/universe/log/universe-web.log" + path: "{{log_dir}}/universe/universe.log" policy: kind: compound trigger: @@ -33,14 +40,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/universe/log/universe-web.{}.log" + pattern: "{{log_dir}}/universe/universe.{}.log" encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} " + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" - # An appender named "base_layer" that writes to a file with a custom pattern encoder - default: + # An appender named "web" that writes to a file with a custom pattern encoder + web: kind: rolling_file - path: "{{log_dir}}/universe/log/universe.log" + path: "{{log_dir}}/universe/universe-web.log" policy: kind: compound trigger: @@ -50,14 +57,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/universe/log/universe.{}.log" + pattern: "{{log_dir}}/universe/universe-web.{}.log" encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} " # An appender named "other" that writes to a file with a custom pattern encoder other: kind: rolling_file - path: "{{log_dir}}/universe/log/other.log" + path: "{{log_dir}}/universe/other.log" policy: kind: compound trigger: @@ -67,10 +74,78 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/universe/log/other.{}.log" + pattern: "{{log_dir}}/universe/other.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " + # An appender named "dan_layer" that writes to a file with a custom pattern encoder + dan_layer: + kind: rolling_file + path: "{{log_dir}}/wallet_daemon/dan_layer.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/wallet_daemon/dan_layer.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" + + # An appender named "dan_layer" that writes to a file with a custom pattern encoder + wallet_daemon: + kind: rolling_file + path: "{{log_dir}}/wallet_daemon/wallet_daemon.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/wallet_daemon/wallet_daemon.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" + + # An appender named "json_rpc" that writes to a file with a custom pattern encoder + json_rpc: + kind: rolling_file + path: "{{log_dir}}/wallet_daemon/json_rpc.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/wallet_daemon/json_rpc.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" + + # An appender named "tapplet" that writes to a file with a custom pattern encoder + tapplet: + kind: rolling_file + path: "{{log_dir}}/tapplet/tapplet.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/tapplet/tapplet.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" + # Set the default logging level to "info" root: level: info @@ -92,3 +167,29 @@ loggers: appenders: - web additive: false + + tari::dan: + level: info + appenders: + - dan_layer + - stdout + additive: false + + tari::dan::wallet_daemon: + level: info + appenders: + - wallet_daemon + - stdout + additive: false + + tari::dan::wallet_daemon::json_rpc: + level: debug + appenders: + - json_rpc + additive: false + + tari::tapplet: + level: info + appenders: + - stdout + additive: false diff --git a/src-tauri/log4rs/wallet_daemon_sample.yml b/src-tauri/log4rs/wallet_daemon_sample.yml index a2ba8fc..296e4fb 100644 --- a/src-tauri/log4rs/wallet_daemon_sample.yml +++ b/src-tauri/log4rs/wallet_daemon_sample.yml @@ -20,6 +20,23 @@ appenders: - kind: threshold level: info + # An appender named "default" that writes to a file with a custom pattern encoder + default: + kind: rolling_file + path: "{{log_dir}}/wallet_daemon/log/wallet_daemon.log" + policy: + kind: compound + trigger: + kind: size + limit: 2mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/wallet_daemon/log/wallet_daemon.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" + # An appender named "dan_layer" that writes to a file with a custom pattern encoder dan_layer: kind: rolling_file @@ -79,17 +96,17 @@ root: loggers: # Route log events common to every application to all appenders - tari::dan_wallet_daemon: - level: info - appenders: - - dan_layer - - stdout - additive: false + # tari::dan::wallet_daemon: + # level: info + # appenders: + # - dan_layer + # - stdout + # additive: false tari::dan: level: info appenders: - - dan_layer + - default - stdout additive: false @@ -97,4 +114,4 @@ loggers: level: debug appenders: - json_rpc - additive: true + additive: false diff --git a/src-tauri/src/wallet_daemon.rs b/src-tauri/src/wallet_daemon.rs index 7e5c6e8..a3bb075 100644 --- a/src-tauri/src/wallet_daemon.rs +++ b/src-tauri/src/wallet_daemon.rs @@ -1,13 +1,14 @@ use std::{ fs, panic, path::PathBuf, process, net::SocketAddr, str::FromStr }; use log::info; +use log4rs::config::RawConfig; use tari_common::{ configuration::Network }; use tari_dan_app_utilities::configuration::load_configuration; use tari_dan_wallet_daemon::{ cli::Cli, config::ApplicationConfig, run_tari_dan_wallet_daemon }; use tari_shutdown::Shutdown; use crate::utils::logging_utils::setup_logging; -const LOG_TARGET: &str = "tari::dan::wallet_daemon::json_rpc"; +const LOG_TARGET: &str = "tari::dan::wallet_daemon"; pub async fn start_wallet_daemon( log_dir: PathBuf, @@ -23,7 +24,15 @@ pub async fn start_wallet_daemon( ); let wallet_daemon_config_file = wallet_daemon_config_file.to_str().unwrap().to_owned(); let log_config_file = &log_dir.join("wallet_daemon").join("configs").join("log4rs_config_wallet.yml"); - setup_logging(&log_config_file.clone(), &log_dir.clone(), include_str!("../log4rs/wallet_daemon_sample.yml"))?; + let contents = setup_logging( + &log_config_file.clone(), + &log_dir.clone(), + include_str!("../log4rs/wallet_daemon_sample.yml") + )?; + let config: RawConfig = serde_yaml + ::from_str(&contents) + .expect("Could not parse the contents of the log file as yaml"); + // log4rs::init_raw_config(config).expect("Could not initialize logging"); let mut cli = Cli::init(); cli.common.network = Some(Network::LocalNet); From 36ffe3e7fb35b968d7c742a4f800ebe8f9ac969b Mon Sep 17 00:00:00 2001 From: karczuRF Date: Tue, 8 Oct 2024 11:13:59 +0200 Subject: [PATCH 4/5] remove unised config yml files --- src-tauri/log4rs/tapplet_sample.yml | 70 ------------- src-tauri/log4rs/universe_sample.yml | 28 +++--- src-tauri/log4rs/wallet_daemon_sample.yml | 117 ---------------------- src-tauri/src/lib.rs | 1 + src-tauri/src/tapplet_server.rs | 5 +- src-tauri/src/wallet_daemon.rs | 11 +- src-tauri/tauri.conf.json | 5 +- 7 files changed, 22 insertions(+), 215 deletions(-) delete mode 100644 src-tauri/log4rs/tapplet_sample.yml delete mode 100644 src-tauri/log4rs/wallet_daemon_sample.yml diff --git a/src-tauri/log4rs/tapplet_sample.yml b/src-tauri/log4rs/tapplet_sample.yml deleted file mode 100644 index 168d140..0000000 --- a/src-tauri/log4rs/tapplet_sample.yml +++ /dev/null @@ -1,70 +0,0 @@ -# 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/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there -# are lots of P2P debug messages, and so this traffic is segregated from the application log messages -# * log/base-node/base_layer.log: Non-comms related INFO-level messages and higher are logged into this file -# * log/base-node/other.log: Third-party crates' messages will be logged here at an ERROR level -# -# 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 "stdout" that writes to stdout - stdout: - kind: console - encoder: - pattern: "{d(%H:%M)} {h({l}):5} {m}{n}" - filters: - - kind: threshold - level: info - - # An appender named "tapplet" that writes to a file with a custom pattern encoder - tapplet: - kind: rolling_file - path: "{{log_dir}}/tapplet/log/tapplet.log" - policy: - kind: compound - trigger: - kind: size - limit: 2mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/tapplet/log/tapplet.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" - - # An appender named "other" that writes to a file with a custom pattern encoder - other: - kind: rolling_file - path: "{{log_dir}}/tapplet/log/other.log" - policy: - kind: compound - trigger: - kind: size - limit: 2mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/tapplet/log/other.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " - -# Set the default logging level to "info" -root: - level: info - appenders: - - other - - stdout - -loggers: - # Route log events common to every application to all appenders - tari::tapplet: - level: debug - appenders: - - stdout - additive: false diff --git a/src-tauri/log4rs/universe_sample.yml b/src-tauri/log4rs/universe_sample.yml index ce51e4d..73bde94 100644 --- a/src-tauri/log4rs/universe_sample.yml +++ b/src-tauri/log4rs/universe_sample.yml @@ -30,7 +30,7 @@ appenders: # An appender named "default" that writes to a file with a custom pattern encoder default: kind: rolling_file - path: "{{log_dir}}/universe/universe.log" + path: "{{log_dir}}/universe/log/universe.log" policy: kind: compound trigger: @@ -40,14 +40,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/universe/universe.{}.log" + pattern: "{{log_dir}}/universe/log/universe.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" # An appender named "web" that writes to a file with a custom pattern encoder web: kind: rolling_file - path: "{{log_dir}}/universe/universe-web.log" + path: "{{log_dir}}/universe/log/universe-web.log" policy: kind: compound trigger: @@ -57,14 +57,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/universe/universe-web.{}.log" + pattern: "{{log_dir}}/universe/log/universe-web.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} " # An appender named "other" that writes to a file with a custom pattern encoder other: kind: rolling_file - path: "{{log_dir}}/universe/other.log" + path: "{{log_dir}}/universe/log/other.log" policy: kind: compound trigger: @@ -74,14 +74,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/universe/other.{}.log" + pattern: "{{log_dir}}/universe/log/other.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " # An appender named "dan_layer" that writes to a file with a custom pattern encoder dan_layer: kind: rolling_file - path: "{{log_dir}}/wallet_daemon/dan_layer.log" + path: "{{log_dir}}/wallet_daemon/log/dan_layer.log" policy: kind: compound trigger: @@ -91,14 +91,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/wallet_daemon/dan_layer.{}.log" + pattern: "{{log_dir}}/wallet_daemon/log/dan_layer.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" # An appender named "dan_layer" that writes to a file with a custom pattern encoder wallet_daemon: kind: rolling_file - path: "{{log_dir}}/wallet_daemon/wallet_daemon.log" + path: "{{log_dir}}/wallet_daemon/log/wallet_daemon.log" policy: kind: compound trigger: @@ -108,14 +108,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/wallet_daemon/wallet_daemon.{}.log" + pattern: "{{log_dir}}/wallet_daemon/log/wallet_daemon.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" # An appender named "json_rpc" that writes to a file with a custom pattern encoder json_rpc: kind: rolling_file - path: "{{log_dir}}/wallet_daemon/json_rpc.log" + path: "{{log_dir}}/wallet_daemon/log/json_rpc.log" policy: kind: compound trigger: @@ -125,14 +125,14 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/wallet_daemon/json_rpc.{}.log" + pattern: "{{log_dir}}/wallet_daemon/log/json_rpc.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" # An appender named "tapplet" that writes to a file with a custom pattern encoder tapplet: kind: rolling_file - path: "{{log_dir}}/tapplet/tapplet.log" + path: "{{log_dir}}/tapplet/log/tapplet.log" policy: kind: compound trigger: @@ -142,7 +142,7 @@ appenders: kind: fixed_window base: 1 count: 5 - pattern: "{{log_dir}}/tapplet/tapplet.{}.log" + pattern: "{{log_dir}}/tapplet/log/tapplet.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" diff --git a/src-tauri/log4rs/wallet_daemon_sample.yml b/src-tauri/log4rs/wallet_daemon_sample.yml deleted file mode 100644 index 296e4fb..0000000 --- a/src-tauri/log4rs/wallet_daemon_sample.yml +++ /dev/null @@ -1,117 +0,0 @@ -# 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/validator-node/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there -# are lots of P2P debug messages, and so this traffic is segregated from the application log messages -# * log/validator-node/dan_layer.log: Non-comms related INFO-level messages and higher are logged into this file -# * log/validator-node/other.log: Third-party crates' messages will be logged here at an ERROR level -# -# 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 "stdout" that writes to stdout - stdout: - kind: console - encoder: - pattern: "{d(%H:%M)} {h({l}):5} {m}{n}" - filters: - - kind: threshold - level: info - - # An appender named "default" that writes to a file with a custom pattern encoder - default: - kind: rolling_file - path: "{{log_dir}}/wallet_daemon/log/wallet_daemon.log" - policy: - kind: compound - trigger: - kind: size - limit: 2mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/wallet_daemon/log/wallet_daemon.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" - - # An appender named "dan_layer" that writes to a file with a custom pattern encoder - dan_layer: - kind: rolling_file - path: "{{log_dir}}/wallet_daemon/log/dan_layer.log" - policy: - kind: compound - trigger: - kind: size - limit: 2mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/wallet_daemon/log/dan_layer.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" - - json_rpc: - kind: rolling_file - path: "{{log_dir}}/wallet_daemon/log/json_rpc.log" - policy: - kind: compound - trigger: - kind: size - limit: 2mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/wallet_daemon/log/json_rpc.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" - - # An appender named "other" that writes to a file with a custom pattern encoder - other: - kind: rolling_file - path: "{{log_dir}}/wallet_daemon/log/other.log" - policy: - kind: compound - trigger: - kind: size - limit: 2mb - roller: - kind: fixed_window - base: 1 - count: 5 - pattern: "{{log_dir}}/wallet_daemon/log/other.{}.log" - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} " - -# Set the default logging level to "info" -root: - level: info - appenders: - - other - - stdout - -loggers: - # Route log events common to every application to all appenders - # tari::dan::wallet_daemon: - # level: info - # appenders: - # - dan_layer - # - stdout - # additive: false - - tari::dan: - level: info - appenders: - - default - - stdout - additive: false - - tari::dan::wallet_daemon::json_rpc: - level: debug - appenders: - - json_rpc - additive: false diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 158017d..72154c9 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -89,6 +89,7 @@ fn setup_tari_universe(app: &mut tauri::App) -> Result<(), Box Result<(), anyhow::Error> { - // setup universe logging + // setup tapplet logging + // TODO create separate dirs for different tapplets let log_config_file = &log_dir.join("tapplet").join("configs").join("log4rs_config_tapplet.yml"); - let _contents = setup_logging(&log_config_file, &log_dir, include_str!("../log4rs/tapplet_sample.yml"))?; + let _contents = setup_logging(&log_config_file, &log_dir, include_str!("../log4rs/universe_sample.yml"))?; Ok(()) } diff --git a/src-tauri/src/wallet_daemon.rs b/src-tauri/src/wallet_daemon.rs index a3bb075..2fa22c7 100644 --- a/src-tauri/src/wallet_daemon.rs +++ b/src-tauri/src/wallet_daemon.rs @@ -1,8 +1,7 @@ use std::{ fs, panic, path::PathBuf, process, net::SocketAddr, str::FromStr }; use log::info; -use log4rs::config::RawConfig; -use tari_common::{ configuration::Network }; +use tari_common::configuration::Network; use tari_dan_app_utilities::configuration::load_configuration; use tari_dan_wallet_daemon::{ cli::Cli, config::ApplicationConfig, run_tari_dan_wallet_daemon }; use tari_shutdown::Shutdown; @@ -24,15 +23,11 @@ pub async fn start_wallet_daemon( ); let wallet_daemon_config_file = wallet_daemon_config_file.to_str().unwrap().to_owned(); let log_config_file = &log_dir.join("wallet_daemon").join("configs").join("log4rs_config_wallet.yml"); - let contents = setup_logging( + let _contents = setup_logging( &log_config_file.clone(), &log_dir.clone(), - include_str!("../log4rs/wallet_daemon_sample.yml") + include_str!("../log4rs/universe_sample.yml") )?; - let config: RawConfig = serde_yaml - ::from_str(&contents) - .expect("Could not parse the contents of the log file as yaml"); - // log4rs::init_raw_config(config).expect("Could not initialize logging"); let mut cli = Cli::init(); cli.common.network = Some(Network::LocalNet); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index ec90044..d41b309 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -39,9 +39,6 @@ "icons/icon.icns", "icons/icon.ico" ], - "resources": [ - "wallet_daemon.config.toml", - "./log4rs/wallet_daemon_sample.yml" - ] + "resources": ["wallet_daemon.config.toml", "./log4rs/universe_sample.yml"] } } From 3cf0b70e04627e5750a512f49d78803e9c18b591 Mon Sep 17 00:00:00 2001 From: karczuRF Date: Mon, 21 Oct 2024 14:18:05 +0200 Subject: [PATCH 5/5] fix: cr comments --- src-tauri/src/lib.rs | 1 - src-tauri/src/tapplet_server.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 72154c9..7d81167 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -81,7 +81,6 @@ fn setup_tari_universe(app: &mut tauri::App) -> Result<(), Box Result<(), anyhow::Error> { // setup tapplet logging - // TODO create separate dirs for different tapplets + // TODO create separate dirs for different tapplets: https://github.com/tari-project/tari-universe/issues/138 let log_config_file = &log_dir.join("tapplet").join("configs").join("log4rs_config_tapplet.yml"); let _contents = setup_logging(&log_config_file, &log_dir, include_str!("../log4rs/universe_sample.yml"))?; Ok(())