mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 22:08:30 +00:00
simulator: Persist beacon logs (#7394)
Beacon logs in the simulator are printed only to stdout. The logs are usually large, so persisting them would be helpful for debugging. Added `--log-dir` parameter to the simulators and a step to upload the logs to Artifacts. (Update) Added `--disable-stdout-logging` to disable stdout logging, making the CI page cleaner.
This commit is contained in:
18
.github/workflows/test-suite.yml
vendored
18
.github/workflows/test-suite.yml
vendored
@@ -295,8 +295,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
channel: stable
|
channel: stable
|
||||||
cache-target: release
|
cache-target: release
|
||||||
|
- name: Create log dir
|
||||||
|
run: mkdir ${{ runner.temp }}/basic_simulator_logs
|
||||||
- name: Run a basic beacon chain sim that starts from Deneb
|
- name: Run a basic beacon chain sim that starts from Deneb
|
||||||
run: cargo run --release --bin simulator basic-sim
|
run: cargo run --release --bin simulator basic-sim --disable-stdout-logging --log-dir ${{ runner.temp }}/basic_simulator_logs
|
||||||
|
- name: Upload logs
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: basic_simulator_logs
|
||||||
|
path: ${{ runner.temp }}/basic_simulator_logs
|
||||||
fallback-simulator-ubuntu:
|
fallback-simulator-ubuntu:
|
||||||
name: fallback-simulator-ubuntu
|
name: fallback-simulator-ubuntu
|
||||||
needs: [check-labels]
|
needs: [check-labels]
|
||||||
@@ -309,8 +316,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
channel: stable
|
channel: stable
|
||||||
cache-target: release
|
cache-target: release
|
||||||
|
- name: Create log dir
|
||||||
|
run: mkdir ${{ runner.temp }}/fallback_simulator_logs
|
||||||
- name: Run a beacon chain sim which tests VC fallback behaviour
|
- name: Run a beacon chain sim which tests VC fallback behaviour
|
||||||
run: cargo run --release --bin simulator fallback-sim
|
run: cargo run --release --bin simulator fallback-sim --disable-stdout-logging --log-dir ${{ runner.temp }}/fallback_simulator_logs
|
||||||
|
- name: Upload logs
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: fallback_simulator_logs
|
||||||
|
path: ${{ runner.temp }}/fallback_simulator_logs
|
||||||
execution-engine-integration-ubuntu:
|
execution-engine-integration-ubuntu:
|
||||||
name: execution-engine-integration-ubuntu
|
name: execution-engine-integration-ubuntu
|
||||||
needs: [check-labels]
|
needs: [check-labels]
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use node_test_rig::{
|
|||||||
};
|
};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@@ -63,6 +64,8 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
.expect("missing debug-level");
|
.expect("missing debug-level");
|
||||||
|
|
||||||
let continue_after_checks = matches.get_flag("continue-after-checks");
|
let continue_after_checks = matches.get_flag("continue-after-checks");
|
||||||
|
let log_dir = matches.get_one::<String>("log-dir").map(PathBuf::from);
|
||||||
|
let disable_stdout_logging = matches.get_flag("disable-stdout-logging");
|
||||||
|
|
||||||
println!("Basic Simulator:");
|
println!("Basic Simulator:");
|
||||||
println!(" nodes: {}", node_count);
|
println!(" nodes: {}", node_count);
|
||||||
@@ -70,6 +73,8 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
println!(" validators-per-node: {}", validators_per_node);
|
println!(" validators-per-node: {}", validators_per_node);
|
||||||
println!(" speed-up-factor: {}", speed_up_factor);
|
println!(" speed-up-factor: {}", speed_up_factor);
|
||||||
println!(" continue-after-checks: {}", continue_after_checks);
|
println!(" continue-after-checks: {}", continue_after_checks);
|
||||||
|
println!(" log-dir: {:?}", log_dir);
|
||||||
|
println!(" disable-stdout-logging: {}", disable_stdout_logging);
|
||||||
|
|
||||||
// Generate the directories and keystores required for the validator clients.
|
// Generate the directories and keystores required for the validator clients.
|
||||||
let validator_files = (0..node_count)
|
let validator_files = (0..node_count)
|
||||||
@@ -91,21 +96,21 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
env_builder,
|
env_builder,
|
||||||
logger_config,
|
logger_config,
|
||||||
stdout_logging_layer,
|
stdout_logging_layer,
|
||||||
_file_logging_layer,
|
file_logging_layer,
|
||||||
_sse_logging_layer_opt,
|
_sse_logging_layer_opt,
|
||||||
_libp2p_discv5_layer,
|
_libp2p_discv5_layer,
|
||||||
) = tracing_common::construct_logger(
|
) = tracing_common::construct_logger(
|
||||||
LoggerConfig {
|
LoggerConfig {
|
||||||
path: None,
|
path: log_dir,
|
||||||
debug_level: tracing_common::parse_level(&log_level.clone()),
|
debug_level: tracing_common::parse_level(&log_level.clone()),
|
||||||
logfile_debug_level: tracing_common::parse_level(&log_level.clone()),
|
logfile_debug_level: tracing_common::parse_level(&log_level.clone()),
|
||||||
log_format: None,
|
log_format: None,
|
||||||
logfile_format: None,
|
logfile_format: None,
|
||||||
log_color: true,
|
log_color: true,
|
||||||
logfile_color: true,
|
logfile_color: false,
|
||||||
disable_log_timestamp: false,
|
disable_log_timestamp: false,
|
||||||
max_log_size: 0,
|
max_log_size: 200,
|
||||||
max_log_number: 0,
|
max_log_number: 5,
|
||||||
compression: false,
|
compression: false,
|
||||||
is_restricted: true,
|
is_restricted: true,
|
||||||
sse_logging: false,
|
sse_logging: false,
|
||||||
@@ -115,12 +120,27 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
EnvironmentBuilder::minimal(),
|
EnvironmentBuilder::minimal(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Err(e) = tracing_subscriber::registry()
|
let workspace_filter = build_workspace_filter()?;
|
||||||
.with(
|
let mut logging_layers = vec![];
|
||||||
|
if !disable_stdout_logging {
|
||||||
|
logging_layers.push(
|
||||||
stdout_logging_layer
|
stdout_logging_layer
|
||||||
.with_filter(logger_config.debug_level)
|
.with_filter(logger_config.debug_level)
|
||||||
.with_filter(build_workspace_filter()?),
|
.with_filter(workspace_filter.clone())
|
||||||
)
|
.boxed(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if let Some(file_logging_layer) = file_logging_layer {
|
||||||
|
logging_layers.push(
|
||||||
|
file_logging_layer
|
||||||
|
.with_filter(logger_config.logfile_debug_level)
|
||||||
|
.with_filter(workspace_filter)
|
||||||
|
.boxed(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Err(e) = tracing_subscriber::registry()
|
||||||
|
.with(logging_layers)
|
||||||
.try_init()
|
.try_init()
|
||||||
{
|
{
|
||||||
eprintln!("Failed to initialize dependency logging: {e}");
|
eprintln!("Failed to initialize dependency logging: {e}");
|
||||||
|
|||||||
@@ -61,6 +61,18 @@ pub fn cli_app() -> Command {
|
|||||||
.long("continue_after_checks")
|
.long("continue_after_checks")
|
||||||
.action(ArgAction::SetTrue)
|
.action(ArgAction::SetTrue)
|
||||||
.help("Continue after checks (default false)"),
|
.help("Continue after checks (default false)"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("log-dir")
|
||||||
|
.long("log-dir")
|
||||||
|
.action(ArgAction::Set)
|
||||||
|
.help("Set a path for logs of beacon nodes that run in this simulation."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("disable-stdout-logging")
|
||||||
|
.long("disable-stdout-logging")
|
||||||
|
.action(ArgAction::SetTrue)
|
||||||
|
.help("Disables stdout logging."),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
@@ -120,6 +132,18 @@ pub fn cli_app() -> Command {
|
|||||||
.long("continue_after_checks")
|
.long("continue_after_checks")
|
||||||
.action(ArgAction::SetTrue)
|
.action(ArgAction::SetTrue)
|
||||||
.help("Continue after checks (default false)"),
|
.help("Continue after checks (default false)"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("log-dir")
|
||||||
|
.long("log-dir")
|
||||||
|
.action(ArgAction::Set)
|
||||||
|
.help("Set a path for logs of beacon nodes that run in this simulation."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("disable-stdout-logging")
|
||||||
|
.long("disable-stdout-logging")
|
||||||
|
.action(ArgAction::SetTrue)
|
||||||
|
.help("Disables stdout logging."),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use node_test_rig::{
|
|||||||
};
|
};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
@@ -69,12 +70,18 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
|
|
||||||
let continue_after_checks = matches.get_flag("continue-after-checks");
|
let continue_after_checks = matches.get_flag("continue-after-checks");
|
||||||
|
|
||||||
|
let log_dir = matches.get_one::<String>("log-dir").map(PathBuf::from);
|
||||||
|
|
||||||
|
let disable_stdout_logging = matches.get_flag("disable-stdout-logging");
|
||||||
|
|
||||||
println!("Fallback Simulator:");
|
println!("Fallback Simulator:");
|
||||||
println!(" vc-count: {}", vc_count);
|
println!(" vc-count: {}", vc_count);
|
||||||
println!(" validators-per-vc: {}", validators_per_vc);
|
println!(" validators-per-vc: {}", validators_per_vc);
|
||||||
println!(" bns-per-vc: {}", bns_per_vc);
|
println!(" bns-per-vc: {}", bns_per_vc);
|
||||||
println!(" speed-up-factor: {}", speed_up_factor);
|
println!(" speed-up-factor: {}", speed_up_factor);
|
||||||
println!(" continue-after-checks: {}", continue_after_checks);
|
println!(" continue-after-checks: {}", continue_after_checks);
|
||||||
|
println!(" log-dir: {:?}", log_dir);
|
||||||
|
println!(" disable-stdout-logging: {}", disable_stdout_logging);
|
||||||
|
|
||||||
// Generate the directories and keystores required for the validator clients.
|
// Generate the directories and keystores required for the validator clients.
|
||||||
let validator_files = (0..vc_count)
|
let validator_files = (0..vc_count)
|
||||||
@@ -95,12 +102,12 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
env_builder,
|
env_builder,
|
||||||
logger_config,
|
logger_config,
|
||||||
stdout_logging_layer,
|
stdout_logging_layer,
|
||||||
_file_logging_layer,
|
file_logging_layer,
|
||||||
_sse_logging_layer_opt,
|
_sse_logging_layer_opt,
|
||||||
_libp2p_discv5_layer,
|
_libp2p_discv5_layer,
|
||||||
) = tracing_common::construct_logger(
|
) = tracing_common::construct_logger(
|
||||||
LoggerConfig {
|
LoggerConfig {
|
||||||
path: None,
|
path: log_dir,
|
||||||
debug_level: tracing_common::parse_level(&log_level.clone()),
|
debug_level: tracing_common::parse_level(&log_level.clone()),
|
||||||
logfile_debug_level: tracing_common::parse_level(&log_level.clone()),
|
logfile_debug_level: tracing_common::parse_level(&log_level.clone()),
|
||||||
log_format: None,
|
log_format: None,
|
||||||
@@ -108,8 +115,8 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
log_color: true,
|
log_color: true,
|
||||||
logfile_color: false,
|
logfile_color: false,
|
||||||
disable_log_timestamp: false,
|
disable_log_timestamp: false,
|
||||||
max_log_size: 0,
|
max_log_size: 200,
|
||||||
max_log_number: 0,
|
max_log_number: 5,
|
||||||
compression: false,
|
compression: false,
|
||||||
is_restricted: true,
|
is_restricted: true,
|
||||||
sse_logging: false,
|
sse_logging: false,
|
||||||
@@ -119,8 +126,24 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
EnvironmentBuilder::minimal(),
|
EnvironmentBuilder::minimal(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let mut logging_layers = vec![];
|
||||||
|
if !disable_stdout_logging {
|
||||||
|
logging_layers.push(
|
||||||
|
stdout_logging_layer
|
||||||
|
.with_filter(logger_config.debug_level)
|
||||||
|
.boxed(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if let Some(file_logging_layer) = file_logging_layer {
|
||||||
|
logging_layers.push(
|
||||||
|
file_logging_layer
|
||||||
|
.with_filter(logger_config.logfile_debug_level)
|
||||||
|
.boxed(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = tracing_subscriber::registry()
|
if let Err(e) = tracing_subscriber::registry()
|
||||||
.with(stdout_logging_layer.with_filter(logger_config.debug_level))
|
.with(logging_layers)
|
||||||
.try_init()
|
.try_init()
|
||||||
{
|
{
|
||||||
eprintln!("Failed to initialize dependency logging: {e}");
|
eprintln!("Failed to initialize dependency logging: {e}");
|
||||||
|
|||||||
Reference in New Issue
Block a user