Skip to content

Commit 3967bd7

Browse files
jope-bmclaude
andcommitted
fix: Respect BASIC_MEMORY_LOG_LEVEL and BASIC_MEMORY_CONSOLE_LOGGING environment variables
Resolves #255 where console logging configuration was not properly respecting environment variables. Changes: - BASIC_MEMORY_LOG_LEVEL environment variable is now read and used before falling back to config file - BASIC_MEMORY_CONSOLE_LOGGING now accepts multiple truthy values: "true", "1", "yes", "on" (case-insensitive) - Fixed timing issue where logging setup occurred before environment variables could be processed The logging setup function now directly reads environment variables first, ensuring user settings are respected immediately during application startup. Signed-off-by: Claude <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Joe P <joe@basicmemory.com>
1 parent b814d40 commit 3967bd7

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/basic_memory/config.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,22 @@ def setup_basic_memory_logging(): # pragma: no cover
351351
# print("Skipping duplicate logging setup")
352352
return
353353

354-
# Check for console logging environment variable
355-
console_logging = os.getenv("BASIC_MEMORY_CONSOLE_LOGGING", "false").lower() == "true"
354+
# Check for console logging environment variable - accept more truthy values
355+
console_logging_env = os.getenv("BASIC_MEMORY_CONSOLE_LOGGING", "false").lower()
356+
console_logging = console_logging_env in ("true", "1", "yes", "on")
357+
358+
# Check for log level environment variable first, fall back to config
359+
log_level = os.getenv("BASIC_MEMORY_LOG_LEVEL")
360+
if not log_level:
361+
config_manager = ConfigManager()
362+
log_level = config_manager.config.log_level
356363

357364
config_manager = ConfigManager()
358365
config = get_project_config()
359366
setup_logging(
360367
env=config_manager.config.env,
361368
home_dir=user_home, # Use user home for logs
362-
log_level=config_manager.config.log_level,
369+
log_level=log_level,
363370
log_file=f"{DATA_DIR_NAME}/basic-memory-{process_name}.log",
364371
console=console_logging,
365372
)

0 commit comments

Comments
 (0)