Skip to content

Commit 7a02ead

Browse files
committed
fix: make CLI/MCP file logging synchronous to avoid hang on exit
1 parent 682a3e1 commit 7a02ead

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/basic_memory/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,16 @@ def setup_logging(
232232
if log_to_file:
233233
log_path = Path.home() / ".basic-memory" / "basic-memory.log"
234234
log_path.parent.mkdir(parents=True, exist_ok=True)
235-
# On Windows, disable enqueue to avoid thread cleanup issues during quick exit
236-
# The background logging thread can hang the process on Windows
237-
use_enqueue = os.name != "nt"
235+
# Keep logging synchronous (enqueue=False) to avoid background logging threads.
236+
# Background threads are a common source of "hang on exit" issues in CLI/test runs.
238237
logger.add(
239238
str(log_path),
240239
level=log_level,
241240
rotation="10 MB",
242241
retention="10 days",
243242
backtrace=True,
244243
diagnose=True,
245-
enqueue=use_enqueue, # Thread-safe async logging (disabled on Windows)
244+
enqueue=False,
246245
colorize=False,
247246
)
248247

0 commit comments

Comments
 (0)