diff --git a/RELEASES.md b/RELEASES.md index ec99f981c3d6..763871962526 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -12,6 +12,7 @@ None - Fixed composite bar requests (#1923), thanks @faysou - Fixed average price calculation for `ValueBarAggregator` (#1927), thanks @faysou - Fixed breaking protobuf issue by pinning `protobuf` and `grpcio` for dYdX (#1929), thanks @davidsblom +- Fixed edge case where exceptions raised in `BacktestNode` prior to engine init would not produce logs, thanks for reporting @faysou --- diff --git a/nautilus_trader/backtest/node.py b/nautilus_trader/backtest/node.py index 91a6a046061e..256717dc962c 100644 --- a/nautilus_trader/backtest/node.py +++ b/nautilus_trader/backtest/node.py @@ -25,6 +25,8 @@ from nautilus_trader.backtest.results import BacktestResult from nautilus_trader.common.component import Logger from nautilus_trader.common.component import LogGuard +from nautilus_trader.common.component import init_logging +from nautilus_trader.common.component import is_logging_initialized from nautilus_trader.common.config import ActorFactory from nautilus_trader.common.config import InvalidConfiguration from nautilus_trader.core import nautilus_pyo3 @@ -159,6 +161,9 @@ def run(self) -> list[BacktestResult]: ) results.append(result) except Exception as e: + if not is_logging_initialized: + init_logging() + # Broad catch all prevents a single backtest run from halting # the execution of the other backtests (such as a zero balance exception). Logger(type(self).__name__).error(f"Error running backtest: {e}")