Skip to content

Commit 35ffe00

Browse files
Merge pull request #125 from cubewise-code/simplify-logging-config-resolution
Simplify logging config resolution and widen handler check
2 parents 579c07e + b81f1f8 commit 35ffe00

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/rushti/cli.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import configparser
1313
import csv
1414
import logging
15-
import logging.handlers
1615
import os
1716
import sys
1817
from datetime import datetime, timedelta
@@ -172,7 +171,7 @@ def _resolve_logging_config(config_path: str) -> configparser.ConfigParser:
172171
173172
Since Python 3.4, fileConfig() accepts a ConfigParser instance directly.
174173
"""
175-
from rushti.utils import resolve_app_path, makedirs_shared
174+
from rushti.utils import resolve_app_path
176175

177176
cp = configparser.ConfigParser()
178177
cp.read(config_path)
@@ -216,8 +215,6 @@ def _resolve_logging_config(config_path: str) -> configparser.ConfigParser:
216215
# Use forward slashes — Python handles them on all platforms,
217216
# and avoids backslash escaping issues inside the args string
218217
resolved_fwd = resolved.replace("\\", "/")
219-
# Ensure the target directory exists and is writable
220-
makedirs_shared(os.path.dirname(resolved))
221218
# Replace only the filename portion in the args string
222219
new_args = args_str[: start_idx + 1] + resolved_fwd + args_str[end_idx:]
223220
cp.set(section, "args", new_args)
@@ -235,7 +232,7 @@ def _resolve_logging_config(config_path: str) -> configparser.ConfigParser:
235232
from rushti.utils import ensure_shared_file, makedirs_shared
236233

237234
for handler in logging.root.handlers:
238-
if isinstance(handler, logging.handlers.RotatingFileHandler):
235+
if isinstance(handler, logging.FileHandler):
239236
makedirs_shared(os.path.dirname(handler.baseFilename))
240237
ensure_shared_file(handler.baseFilename)
241238

0 commit comments

Comments
 (0)