Log format related options should not be application-specific

Bug #1075095 reported by Zhongyue Luo
34
This bug affects 5 people
Affects Status Importance Assigned to Milestone
oslo.log
Confirmed
Medium
Unassigned

Bug Description

The options below are tightly coupled with Nova.

    cfg.StrOpt('logging_context_format_string',
               default='%(asctime)s %(levelname)s %(name)s [%(request_id)s '
                       '%(user_id)s %(project_id)s] %(instance)s'
                       '%(message)s',
               help='format string to use for log messages with context'),
    cfg.StrOpt('logging_default_format_string',
               default='%(asctime)s %(process)d %(levelname)s %(name)s [-]'
                       ' %(instance)s%(message)s',
               help='format string to use for log messages without context'),
    cfg.StrOpt('logging_exception_prefix',
               default='%(asctime)s %(process)d TRACE %(name)s %(instance)s',
               help='prefix each line of exception output with this format'),
    cfg.StrOpt('instance_format',
               default='[instance: %(uuid)s] ',
               help='If an instance is passed with the log message, format '
                    'it like this'),
    cfg.StrOpt('instance_uuid_format',
               default='[instance: %(uuid)s] ',
               help='If an instance UUID is passed with the log message, '
                    'format it like this')

The default log format in openstack-common should be minimal and each project should override these configs.

Introducing a unknown key value results with a python exception.
For example if I change the 'logging_context_format_string' to '.....%(volume)s......' in cinder, the process will complain that it couldn't find the key 'volume' in the given dict parameter.
I had to edit the process method in log.py to resolve this problem.

New entities should also be easy to define in the conf file in each project with out changing the common code.

Mark McLoughlin (markmc)
affects: openstack-common → oslo
Revision history for this message
Mark McLoughlin (markmc) wrote :

Yep, this makes sense - instance_format etc. certainly smells nova specific

Not sure exactly what the best answer is though

Changed in oslo:
status: New → Confirmed
importance: Undecided → Medium
affects: oslo-incubator → oslo.log
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :
summary: - Log format related options in log.py should be minimal
+ Log format related options in log.py should not be application-specific
summary: - Log format related options in log.py should not be application-specific
+ Log format related options should not be application-specific
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.