[PR #19838] [MERGED] Closes #19816: Implement a logging mechanism for background jobs #15733

Closed
opened 2025-12-30 00:23:43 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19838
Author: @jeremystretch
Created: 7/8/2025
Status: Merged
Merged: 7/14/2025
Merged by: @jnovinger

Base: featureHead: 19816-job-logging


📝 Commits (8)

📊 Changes

19 files changed (+276 additions, -51 deletions)

View changed files

📝 docs/configuration/system.md (+1 -0)
📝 docs/plugins/development/background-jobs.md (+21 -0)
📝 netbox/core/api/serializers_/jobs.py (+1 -1)
📝 netbox/core/constants.py (+17 -9)
netbox/core/dataclasses.py (+21 -0)
📝 netbox/core/jobs.py (+6 -3)
netbox/core/migrations/0016_job_log_entries.py (+28 -0)
📝 netbox/core/models/jobs.py (+21 -0)
📝 netbox/core/tables/columns.py (+14 -8)
📝 netbox/core/tables/jobs.py (+28 -2)
📝 netbox/core/tables/tasks.py (+4 -2)
📝 netbox/core/views.py (+21 -2)
📝 netbox/extras/jobs.py (+5 -1)
📝 netbox/netbox/jobs.py (+18 -0)
📝 netbox/netbox/tests/test_jobs.py (+12 -1)
📝 netbox/templates/core/job.html (+1 -22)
netbox/templates/core/job/base.html (+23 -0)
netbox/templates/core/job/log.html (+12 -0)
📝 netbox/utilities/json.py (+22 -0)

📄 Description

Closes: #19816

  • Add the log_entries ArrayField to the Job model, to store log messages
  • Instantiate a Python logger when initializing a JobRunner subclass
  • Introduce JobLogHandler to connect native Python logging to the job instance
  • Enabled job logging for custom script execution and data source synchronization
  • Add JobLogView to view log data in UI
  • Renamed RQJobStatusColumn to BadgeColumn and repurposed for general use

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/19838 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 7/8/2025 **Status:** ✅ Merged **Merged:** 7/14/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `feature` ← **Head:** `19816-job-logging` --- ### 📝 Commits (8) - [`ae3de95`](https://github.com/netbox-community/netbox/commit/ae3de95dce14fb4ac1f845a007343a1c747aa7f4) Initial work on #19816 - [`92a13a4`](https://github.com/netbox-community/netbox/commit/92a13a42262b06e60b30f1aca8fc474fe2403d68) Use TZ-aware timestamps - [`e95c382`](https://github.com/netbox-community/netbox/commit/e95c3825de4e144486d060e4c59e9754b9d8b179) Deserialize JobLogEntry timestamp - [`9946ff9`](https://github.com/netbox-community/netbox/commit/9946ff910c2982bf051decd9e377342798e3d196) Repurpose RQJobStatusColumn to display job entry level badges - [`6b2643c`](https://github.com/netbox-community/netbox/commit/6b2643c9cd324e1af2d4d2f7a5156f364304bab5) Misc cleanup - [`37fb8ae`](https://github.com/netbox-community/netbox/commit/37fb8ae8ae3fb5e8b76983bf47af7c0af36532a3) Test logging - [`eb86b9d`](https://github.com/netbox-community/netbox/commit/eb86b9d6b0e6fbd24d06a28c963b74893856c29c) Refactor HTML templates - [`a3ee46a`](https://github.com/netbox-community/netbox/commit/a3ee46a32ae9757c88cf963a813d1b59c07b80a2) Update documentation ### 📊 Changes **19 files changed** (+276 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `docs/configuration/system.md` (+1 -0) 📝 `docs/plugins/development/background-jobs.md` (+21 -0) 📝 `netbox/core/api/serializers_/jobs.py` (+1 -1) 📝 `netbox/core/constants.py` (+17 -9) ➕ `netbox/core/dataclasses.py` (+21 -0) 📝 `netbox/core/jobs.py` (+6 -3) ➕ `netbox/core/migrations/0016_job_log_entries.py` (+28 -0) 📝 `netbox/core/models/jobs.py` (+21 -0) 📝 `netbox/core/tables/columns.py` (+14 -8) 📝 `netbox/core/tables/jobs.py` (+28 -2) 📝 `netbox/core/tables/tasks.py` (+4 -2) 📝 `netbox/core/views.py` (+21 -2) 📝 `netbox/extras/jobs.py` (+5 -1) 📝 `netbox/netbox/jobs.py` (+18 -0) 📝 `netbox/netbox/tests/test_jobs.py` (+12 -1) 📝 `netbox/templates/core/job.html` (+1 -22) ➕ `netbox/templates/core/job/base.html` (+23 -0) ➕ `netbox/templates/core/job/log.html` (+12 -0) 📝 `netbox/utilities/json.py` (+22 -0) </details> ### 📄 Description ### Closes: #19816 - Add the `log_entries` ArrayField to the Job model, to store log messages - Instantiate a Python logger when initializing a JobRunner subclass - Introduce JobLogHandler to connect native Python logging to the job instance - Enabled job logging for custom script execution and data source synchronization - Add JobLogView to view log data in UI - Renamed RQJobStatusColumn to BadgeColumn and repurposed for general use --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:23:43 +01:00
adam closed this issue 2025-12-30 00:23:43 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15733