diff --git a/examples/rust/get_started/src/token.rs b/examples/rust/get_started/src/token.rs index 9a2074a9916..9cc798abbf0 100644 --- a/examples/rust/get_started/src/token.rs +++ b/examples/rust/get_started/src/token.rs @@ -19,7 +19,6 @@ pub async fn create_token(attribute_name: &str, attribute_value: &str) -> Result "--attribute", format!("{attribute_name}={attribute_value}").as_str(), ]) - .env_remove("OCKAM_LOG") // make sure that OCKAM_LOG is not set, otherwise the output will contain more than the token .env_remove("OCKAM_LOGGING") // make sure that OCKAM_LOGGING is not set, otherwise the output will contain more than the token .output() .map_err(|e| error(format!("could not run the `ockam project ticket` successfully: {e:?}")))?; diff --git a/implementations/rust/ockam/ockam_api/tests/latency.rs b/implementations/rust/ockam/ockam_api/tests/latency.rs index 8a49f41334b..a4c8c1c96d0 100644 --- a/implementations/rust/ockam/ockam_api/tests/latency.rs +++ b/implementations/rust/ockam/ockam_api/tests/latency.rs @@ -24,7 +24,7 @@ use ockam_transport_core::HostnamePort; pub fn measure_message_latency_two_nodes() { let runtime = Arc::new(Runtime::new().unwrap()); let runtime_cloned = runtime.clone(); - std::env::set_var("OCKAM_LOG", "none"); + std::env::set_var("OCKAM_LOGGING", "false"); let result: ockam::Result<()> = runtime_cloned.block_on(async move { let test_body = async move { @@ -120,7 +120,7 @@ pub fn measure_message_latency_two_nodes() { pub fn measure_buffer_latency_two_nodes_portal() { let runtime = Arc::new(Runtime::new().unwrap()); let runtime_cloned = runtime.clone(); - std::env::set_var("OCKAM_LOG", "none"); + std::env::set_var("OCKAM_LOGGING", "false"); let result: ockam::Result<()> = runtime_cloned.block_on(async move { let test_body = async move { diff --git a/implementations/rust/ockam/ockam_api/tests/portals.rs b/implementations/rust/ockam/ockam_api/tests/portals.rs index f50a5266a42..2bd59698449 100644 --- a/implementations/rust/ockam/ockam_api/tests/portals.rs +++ b/implementations/rust/ockam/ockam_api/tests/portals.rs @@ -92,7 +92,7 @@ fn portal_node_goes_down_reconnect() { let runtime = Arc::new(Runtime::new().unwrap()); let handle = runtime.handle(); let runtime_cloned = runtime.clone(); - std::env::set_var("OCKAM_LOG", "none"); + std::env::set_var("OCKAM_LOGGING", "false"); let result: ockam::Result<()> = handle.block_on(async move { let test_body = async move { @@ -238,7 +238,7 @@ fn portal_low_bandwidth_connection_keep_working_for_60s() { let runtime = Arc::new(Runtime::new().unwrap()); let handle = runtime.handle(); let runtime_cloned = runtime.clone(); - std::env::set_var("OCKAM_LOG", "none"); + std::env::set_var("OCKAM_LOGGING", "false"); let result: ockam::Result<()> = handle.block_on(async move { let test_body = async move { @@ -359,7 +359,7 @@ fn portal_heavy_load_exchanged() { let runtime = Arc::new(Runtime::new().unwrap()); let handle = runtime.handle(); let runtime_cloned = runtime.clone(); - std::env::set_var("OCKAM_LOG", "none"); + std::env::set_var("OCKAM_LOGGING", "false"); let result: ockam::Result<()> = handle.block_on(async move { let test_body = async move { @@ -505,7 +505,7 @@ fn test_portal_payload_transfer(outgoing_disruption: Disruption, incoming_disrup let runtime = Arc::new(Runtime::new().unwrap()); let handle = runtime.handle(); let runtime_cloned = runtime.clone(); - std::env::set_var("OCKAM_LOG", "none"); + std::env::set_var("OCKAM_LOGGING", "false"); let result: ockam::Result<_> = handle.block_on(async move { let test_body = async move { diff --git a/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt b/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt index 9bb2c7a7e9c..2f23aee72a8 100644 --- a/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt +++ b/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt @@ -13,7 +13,6 @@ CLI Behavior - PAGER: a `string` that defines the pager to use for long help/usage messages. Defaults to `less`. Logging -- OCKAM_LOG (deprecated, use OCKAM_LOGGING and OCKAM_LOG_LEVEL instead): a `string` that defines the verbosity of the logs when the `--verbose` argument is not passed: `info`, `warn`, `error`, `debug` or `trace`. - OCKAM_LOGGING: set this variable to any value in order to enable logging. - OCKAM_LOG_LEVEL: a `string` that defines the verbosity of the logs when the `--verbose` argument is not passed: `info`, `warn`, `error`, `debug` or `trace`. Default value: `debug`. - OCKAM_LOG_FORMAT: a `string` that overrides the default format of the logs: `default`, `json`, or `pretty`. Default value: `default`. diff --git a/implementations/rust/ockam/ockam_macros/src/node_test_attribute.rs b/implementations/rust/ockam/ockam_macros/src/node_test_attribute.rs index d64a9e2e8b3..91be9aaf16e 100644 --- a/implementations/rust/ockam/ockam_macros/src/node_test_attribute.rs +++ b/implementations/rust/ockam/ockam_macros/src/node_test_attribute.rs @@ -95,13 +95,6 @@ fn output(mut cont: Container) -> TokenStream { use core::time::Duration; use ockam_core::{Error, errcode::{Origin, Kind}}; use #ockam_crate::{NodeBuilder, compat::{tokio::time::timeout, futures::FutureExt}}; - // don't enable logs in tests by default - use ockam_core::env::get_env; - - match get_env::("OCKAM_LOG").unwrap() { - None => std::env::set_var("OCKAM_LOG", "none"), - Some(_) => (), - }; // we don't exit on a panic because we want to catch the panic and report it from within the test. let (mut #ctx_ident, mut executor) = NodeBuilder::new().no_exit_on_panic().build(); diff --git a/implementations/rust/ockam/ockam_node/src/node.rs b/implementations/rust/ockam/ockam_node/src/node.rs index 4aac46ed4ea..e7f416b43f0 100644 --- a/implementations/rust/ockam/ockam_node/src/node.rs +++ b/implementations/rust/ockam/ockam_node/src/node.rs @@ -161,7 +161,7 @@ fn setup_tracing() { use tracing_subscriber::{filter::LevelFilter, fmt, prelude::*, EnvFilter}; static ONCE: std::sync::Once = std::sync::Once::new(); ONCE.call_once(|| { - let filter = EnvFilter::try_from_env("OCKAM_LOG").unwrap_or_else(|_| { + let filter = EnvFilter::try_from_env("OCKAM_LOGGING").unwrap_or_else(|_| { EnvFilter::default() .add_directive(LevelFilter::INFO.into()) .add_directive("ockam_node=info".parse().unwrap()) diff --git a/tools/docs/example_test_helper/src/lib.rs b/tools/docs/example_test_helper/src/lib.rs index 74fb01923fe..a660f10da06 100644 --- a/tools/docs/example_test_helper/src/lib.rs +++ b/tools/docs/example_test_helper/src/lib.rs @@ -4,7 +4,7 @@ //! described by command lines. //! //! Processes have these environment variables set... -//! - `OCKAM_LOG=trace` +//! - `OCKAM_LOGGING=true; OCKAM_LOG_LEVEL=trace` //! //! Some functions will timeout if [`DEFAULT_TIMEOUT_MS`] milliseconds //! pass. In particular [`CmdBuilder::run()`], but not [`CmdBuilder::spawn()`]. @@ -57,7 +57,8 @@ use tracing_subscriber::fmt::TestWriter; use tracing_subscriber::{filter::LevelFilter, fmt, EnvFilter}; const POLL_MS: u32 = 250; -const ENVIRONMENT_VARIABLES: &[(&str, &str)] = &[("OCKAM_LOG", "trace")]; +const ENVIRONMENT_VARIABLES: &[(&str, &str)] = + &[("OCKAM_LOGGING", "true"), ("OCKAM_LOG_LEVEL", "trace")]; /// Default timeout value in milliseconds. pub const DEFAULT_TIMEOUT_MS: u32 = 180_000; diff --git a/tools/stress-test/README.md b/tools/stress-test/README.md index 3d2060cd88a..219e31f623c 100644 --- a/tools/stress-test/README.md +++ b/tools/stress-test/README.md @@ -24,10 +24,11 @@ Options: To debug failures, you can use: ``` -OCKAM_LOG=error stress-test run --log +OCKAM_LOGGING=true; OCKAM_LOG_LEVEL=error stress-test run --log ``` Sample configuration: + ``` peak_portals = 20 peak_relays = 10 @@ -36,15 +37,16 @@ throughput = "1 mbits" project = "/project/default" ``` -| Parameter | Default | Description | Possible values | -|---------------|------------------|--------------------------------------------------------|------------------------------------------------------------------------------------------| -| peak_portals | 0 | Number of portals to create | positive integers, 1_000 is allowed | -| peak_relays | 0 | Number of relays to create, at least 1 is created | positive integers, 1_000 is allowed | -| ramp_up | 0 | Time, in seconds, to create all the portals and relays | positive integers | -| throughput | unlimited | Throughput to use for each portal | unlimited or positive integer followed by GBits,Mbits,Kbits,Bits, 1_000 Mbits is allowed | -| project | /project/default | Route to any project to test | Any route as long as it reaches a project | +| Parameter | Default | Description | Possible values | +|--------------|------------------|--------------------------------------------------------|------------------------------------------------------------------------------------------| +| peak_portals | 0 | Number of portals to create | positive integers, 1_000 is allowed | +| peak_relays | 0 | Number of relays to create, at least 1 is created | positive integers, 1_000 is allowed | +| ramp_up | 0 | Time, in seconds, to create all the portals and relays | positive integers | +| throughput | unlimited | Throughput to use for each portal | unlimited or positive integer followed by GBits,Mbits,Kbits,Bits, 1_000 Mbits is allowed | +| project | /project/default | Route to any project to test | Any route as long as it reaches a project | Sample output: + ``` | Elapsed | Portals | Relays | M. sent | M. recv | In-fli | B. sent | B. recv | Spe. sent | Spe. recv | M. OOO | Errors | | 00s | 0 | 0 | 0 | 0 | 0 | 0 B | 0 B | 0.00 bps | 0.00 bps | 0 | 0 |