DEBUG upward. The console shows only the level you configure.
How Logging Works in Cognee
When you import or start Cognee,setup_logging() is called automatically. It configures two handlers:
- Console handler — writes colored output to
stderr, filtered byLOG_LEVEL(default:INFO) - File handler — writes plain text to a timestamped
.logfile, always atDEBUGlevel
Default log file locations
Default log file locations
The default Running from source (cloned repository):Using the MCP server:
The MCP server uses the same logging setup. The log directory is the same as above, depending on your environment. When a background task is launched, the MCP server returns the full path to the active log file in its response.
logs/ directory is created next to the cognee package directory, one level above it. The exact path depends on how Cognee is installed.Installed via pip (e.g. pip install cognee):Controlling Logging
Environment Variables
COGNEE_LOGS_DIR— Absolute path to a custom log directory. Cognee creates it if it does not exist. Must be an absolute path — relative paths cause a startup error. Default:logs/next to thecogneepackage.LOG_LEVEL— Console log verbosity. One ofDEBUG,INFO,WARNING,ERROR,CRITICAL. Default:INFO. Does not affect the log file, which always capturesDEBUGand above.
Configuration Examples
Fallback Behavior
If Cognee cannot write toCOGNEE_LOGS_DIR, it falls back to /tmp/cognee_logs. If that also fails, file logging is skipped silently and only console output is produced.
Log Files and Their Content
File Format
Log files use plain text, one entry per line. Timestamps are in UTC:Console Format
The console uses structlog’s colored renderer, written tostderr. Level colors: DEBUG blue, INFO green, WARNING yellow, ERROR and CRITICAL red.
What to Expect at Startup
Every time Cognee initializes, the following four messages are logged in order:- WARNING — A notice that multi-user access control is on by default since version 0.5.0. This is expected and not an error.
- INFO — The full path to the log file created for this session.
- INFO — System metadata: Python version, Cognee version, OS, database paths, and the active graph, vector, and relational providers.
- INFO — The database storage path.
COGNEE_LOGS_DIR to a path you control.
File Naming
Each log file is named after the startup timestamp:2025-02-14_15-32-47.log
Troubleshooting
Can't find the log file
Can't find the log file
Run this snippet after importing cognee to get the exact path:
No log file is created
No log file is created
Cognee falls back to console-only logging if the log directory is not writable. This is common in managed environments where
site-packages/ is read-only.Set COGNEE_LOGS_DIR to an absolute path you own: