claude-memory/graph/fixes/missing-logger-import-causes-nameerror-in-python-modules-7b6d18.md
2026-02-13 14:35:29 -06:00

863 B

id type title tags importance confidence created updated relations
7b6d183b-e221-471a-8078-e8639ebdd55a fix Missing logger import causes NameError in Python modules
python
logging
bug
nameerror
fix
troubleshooting
0.5 0.8 2026-02-13T20:35:13.483029+00:00 2026-02-13T20:35:29.511702+00:00
target type direction strength
d0e2e9ab-9a46-44b3-b749-8c2a562d0a1b RELATED_TO outgoing 0.8

Common bug when adding logging to existing Python code: calling logger.info() without importing logging module.

Error: NameError: name 'logger' is not defined

Fix: import logging

logger = logging.getLogger(name)

Always add both lines at top of module when adding logging.

In discord bot config.py, save() and add_project() methods called logger.info() but module lacked import. Added imports, committed, restarted service.