diff --git a/crates/utils/src/config.rs b/crates/utils/src/config.rs index 42213b1e0..d37b3c088 100644 --- a/crates/utils/src/config.rs +++ b/crates/utils/src/config.rs @@ -857,7 +857,7 @@ pub mod rotation_format { #[must_use] #[inline] pub const fn default_rotation() -> RotationConfig { - RotationConfig::Daily + RotationConfig::Never } /// Generates a `RollingFileAppender` from the given `RotationConfig` and `name` @@ -1453,7 +1453,7 @@ mod tests { config.log, LogConfig::new( Some(PathBuf::from("/var/log/xline")), - RotationConfig::Daily, + RotationConfig::Never, LevelConfig::INFO ) ); diff --git a/crates/utils/src/parser.rs b/crates/utils/src/parser.rs index c37019c08..c777dc0da 100644 --- a/crates/utils/src/parser.rs +++ b/crates/utils/src/parser.rs @@ -177,8 +177,8 @@ pub fn parse_log_file(s: &str) -> Result { // Explanation of the regex pattern: // ^(\.|\.\.|~)? - Matches an optional prefix consisting of a dot (.), two dots (..), or a tilde (~). // (/[a-zA-Z0-9._-]+)+/? - Matches one or more occurrences of a forward slash (/) followed by one or more alphanumeric characters, dots (.), underscores (_), or hyphens (-). - // /?$ - Matches an optional trailing forward slash (/) at the end of the string. // Overall, this regex pattern is used to validate file paths that follow - // a specific format commonly used in systems like Cargo in Rust. + // /?$ - Matches an optional trailing forward slash (/) at the end of the string. + // Overall, this regex pattern is used to validate file paths that follow a specific format commonly used in Linux filesystem let re = Regex::new(r"^(\.|\.\.|~)?(/[a-zA-Z0-9._-]+)+/?$").unwrap_or_else(|err| { unreachable!( r"regex expression (^(\.|\.\.|~)?(/[a-zA-Z0-9._-]+)+/?$) should not return Error: {}", diff --git a/crates/xline/src/utils/trace.rs b/crates/xline/src/utils/trace.rs index b605c9972..9384626a1 100644 --- a/crates/xline/src/utils/trace.rs +++ b/crates/xline/src/utils/trace.rs @@ -4,14 +4,14 @@ use opentelemetry_sdk::runtime::Tokio; use tracing::warn; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{fmt::format, layer::SubscriberExt, util::SubscriberInitExt, Layer}; -use utils::config::{default_rotation, file_appender, LogConfig, TraceConfig}; +use utils::config::{file_appender, LogConfig, RotationConfig, TraceConfig}; /// Return a Box trait from the config fn generate_writer(name: &str, log_config: &LogConfig) -> Box { if let Some(ref file_path) = *log_config.path() { Box::new(file_appender(*log_config.rotation(), file_path, name)) } else { - if *log_config.rotation() != default_rotation() { + if matches!(*log_config.rotation(), RotationConfig::Never) { warn!("The log is output to the terminal, so the rotation parameter is ignored."); } Box::new(std::io::stdout()) diff --git a/scripts/common.sh b/scripts/common.sh index 9c5d7de99..cd7bb555c 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -68,15 +68,13 @@ function common::run_xline() { fi if [ -n "$RUST_LOG" ]; then - docker_cmd="docker run -e RUST_LOG=${RUST_LOG} -d -it --rm --name=node${ith} --net=xline_net \ - --ip=${SERVERS[$ith]} --cap-add=NET_ADMIN --cpu-shares=1024 \ - -m=512M ${mount_point} ${XLINE_IMAGE} ${cmd}" - else - docker_cmd="docker run -d -it --rm --name=node${ith} --net=xline_net \ - --ip=${SERVERS[$ith]} --cap-add=NET_ADMIN --cpu-shares=1024 \ - -m=512M ${mount_point} ${XLINE_IMAGE} ${cmd}" + debug_env="-e RUST_LOG=${RUST_LOG}" fi + docker_cmd="docker run ${debug_env} -d -it --rm --name=node${ith} --net=xline_net \ + --ip=${SERVERS[$ith]} --cap-add=NET_ADMIN --cpu-shares=1024 \ + -m=512M ${mount_point} ${XLINE_IMAGE} ${cmd}" + eval ${docker_cmd} wait $!