Skip to content

Introduce a dedicated logging mechanism for jobs #19816

@jeremystretch

Description

@jeremystretch

NetBox version

v4.3.3

Feature type

New functionality

Proposed functionality

Add to the JobRunner class a log() mechanism which can be used to record arbitrary log messages during job execution. These messages will be stored separately from job data. Each log message should include:

  • Timestamp
  • Level (see below)
  • Message

Supported levels should include the following, which map directly to native Python logging levels:

  • Debug
  • Info (default)
  • Warning
  • Error

(Note that these levels are not to be confused with the levels support for custom script logging, which differ in the nature of their use.)

Use case

This would provide a convenient, persistent mechanism to record log messages during the execution of a job, without requiring the job's author to devise a custom implementation.

Database changes

Add a log field to the Job model. This could be a JSONField or an ArrayField, depending on how we structure the data.

External dependencies

N/A

Metadata

Metadata

Assignees

Labels

complexity: mediumRequires a substantial but not unusual amount of effort to implementstatus: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions