airship-in-a-bottle/doc/source/service-logging-conventions.rst
Bryan Strassner 44b38244c4 Cleanup Airship verbiage in docs
This change attempts to move the airship-in-a-bottle documentation
closer to a target state for Airship by removing references to the
Undercloud Platform. This triggered the reformating of some paragraphs,
but this change does not attempt to correct all of the information -
much more a syntactical change of the documentation than a semantic
change. Requests to correct information in any significant way will be
deferred to subsequent work.

Some completely outdated pages were removed completely, as they provided
more distraction than benefit.

Documents that were "under development" since their inception (and
nothing more than "under development") have been eliminated and may be
re-instantiated if anyone ever has anything to say about the topics, but
for now, removed the clutter.

Change-Id: Ida72b3706c894771888d8b694e1cf95d6cf810ed
2018-08-15 16:08:10 -05:00

2.3 KiB

Service Logging Conventions

Airship services must provide logging, should conform to a standard logging format, and may utilize shared code to do so.

Standard Logging Format

The following is the intended format to be used when logging from Airship services. When logging from those parts that are no services, a close reasonable approximation is desired.

Timestamp Level RequestID ExternalContextID ModuleName(Line) Function - Message

Where:

  • Timestamp is like 2006-02-08 22:20:02,165, or the standard ouptut from %(asctime)s
  • Level is 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', padded to 8 characters, left aligned.
  • RequestID is the UUID assigned to the request in canonical 8-4-4-4-12 format.
  • ExternalContextID is the UUID assigned from the external source (or generated for the same purpose), in 8-4-4-4-12 format.
  • ModuleName is the name of the module or class from which the logging originates.
  • Line is the line number of the logging statement
  • Function is the name of the function or method from which the logging originates
  • Message is the text of the message to be logged.

Example Python Logging Format

%(asctime)s %(levelname)-8s %(req_id)s %(external_ctx)s %(user)s %(module)s(%(lineno)d) %(funcName)s - %(message)s'

See Python Logging for explanation of format.

Loggers in Code

Components should prefer loggers that are at the module or class level, allowing for finer grained logging control than a global logger.