Skip to content

Logging integration design discussion #616

Open
@reyang

Description

@reyang

@c24t wish to know your thoughts as you've done the pilot work in #536.

  1. Currently the use_oc_logging works for all loggers created after the call. There is another way to work with loggers created before the call (although it could have wide impact, and only works for Py3.x), should we consider it (which seems to be useful for automatic capturing unhandled exceptions)?
class ContextLogRecord(logging.LogRecord):
    def __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None):
        self.trace_id = 'foo'
        self.span_id = 'bar'
        return super(ContextLogRecord, self).__init__(name, level, pathname, lineno, msg, args, exc_info, func, sinfo)

logging.setLogRecordFactory(ContextLogRecord)
  1. Do we want to move use_oc_logging to an ext package and use config_integration?
config_integration.trace_integrations(['logging'])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions