Skip to content

Conversation

@dimitri-yatsenko
Copy link
Member

@dimitri-yatsenko dimitri-yatsenko commented Jan 27, 2026

Summary

  • Route all DataJoint logs to stdout by default (configurable)
  • Add DJ_LOG_STREAM env var to select stdout or stderr
  • Simplify INFO/DEBUG format by removing the level tag
  • Keep [WARNING] and [ERROR] tags for actual issues
  • Add JOBS log level for make status messages (start/error/success)

Environment Variables

Variable Values Default Description
DJ_LOG_LEVEL DEBUG, JOBS, INFO, WARNING, ERROR INFO Minimum log level
DJ_LOG_STREAM stdout, stderr stdout Output stream

Log Levels

DEBUG (10) < JOBS (15) < INFO (20) < WARNING (30) < ERROR (40)
  • DJ_LOG_LEVEL=INFO — Default, hides job messages
  • DJ_LOG_LEVEL=JOBS — Shows job status messages
  • DJ_LOG_LEVEL=DEBUG — Shows everything

Rationale

  1. stdout vs stderr: The current logging appears with red highlighting in terminals/IDEs because Python's StreamHandler defaults to stderr. Using stdout avoids this. Users needing stderr can set DJ_LOG_STREAM=stderr.

  2. JOBS level: Make status messages (start/error/success) were at DEBUG level, getting buried. A dedicated level between DEBUG and INFO allows filtering without losing them entirely. Running thousands of jobs won't flood INFO logs.

Example Output

[2026-01-27 10:30:45] DataJoint 2.0.0 connected to postgres@localhost:5432
[2026-01-27 10:30:46][JOBS]: Making {'key': 1} -> schema.Table
[2026-01-27 10:30:47][JOBS]: Success making {'key': 1} -> schema.Table
[2026-01-27 10:31:02][WARNING]: Table xyz not found

Notes

  • Users can also configure custom handlers via datajoint.logging.logger
  • Future enhancement: structured logging / JSON format option

🤖 Generated with Claude Code

@github-actions github-actions bot added bug Indicates an unexpected problem or unintended behavior enhancement Indicates new improvements labels Jan 27, 2026
Copy link

@mweitzel mweitzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful

@dimitri-yatsenko dimitri-yatsenko removed the bug Indicates an unexpected problem or unintended behavior label Jan 27, 2026
- Route all DataJoint logs to stdout instead of stderr
  (avoids red highlighting in terminals/IDEs that color stderr)
- Simplify INFO/DEBUG format: remove level tag for cleaner output
- Keep [WARNING] and [ERROR] tags for actual issues
- Add JOBS log level (15, between DEBUG and INFO) for make status
  messages (start/error/success) so they don't flood INFO logs

Log levels: DEBUG (10) < JOBS (15) < INFO (20) < WARNING (30) < ERROR (40)

Example output:
  [2026-01-27 10:30:45] DataJoint 2.0.0 connected to postgres@localhost:5432
  [2026-01-27 10:30:46][JOBS]: Making {'key': 1} -> schema.Table
  [2026-01-27 10:30:47][JOBS]: Success making {'key': 1} -> schema.Table
  [2026-01-27 10:31:02][WARNING]: Table xyz not found

Users can filter job messages with DJ_LOG_LEVEL=INFO (hides JOBS)
or see them with DJ_LOG_LEVEL=JOBS or DJ_LOG_LEVEL=DEBUG.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions github-actions bot added the bug Indicates an unexpected problem or unintended behavior label Jan 27, 2026
@dimitri-yatsenko dimitri-yatsenko removed the bug Indicates an unexpected problem or unintended behavior label Jan 27, 2026
@dimitri-yatsenko dimitri-yatsenko merged commit 8c85a9b into master Jan 27, 2026
7 of 8 checks passed
@dimitri-yatsenko dimitri-yatsenko deleted the fix/logging-stdout branch January 27, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Indicates new improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants