Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of LoggingHandler in autoinstrumentation #4034

Open
lzchen opened this issue Jul 8, 2024 · 1 comment · May be fixed by #4203
Open

Allow configuration of LoggingHandler in autoinstrumentation #4034

lzchen opened this issue Jul 8, 2024 · 1 comment · May be fixed by #4203
Labels
auto-instrumentation related to auto-instrumentation of the sdk feature-request logging

Comments

@lzchen
Copy link
Contributor

lzchen commented Jul 8, 2024

Is your feature request related to a problem?

Currently in autoinstrumentation, the default LoggingHandler configuration is defaulted to NOTSET, which effectively does not filter messages based on level.

For format configuration, this pr enables the LoggingHandler to respect configured formats for the logging handler.

With MANUAL instrumentation, users can configure logging like below:

logging.config.dictConfig({
    "version": 1,
    "formatters": {
        "simple": {"format": "%(name)s [%(module)s.%(lineno)s]: %(message)s"}
    },
    "handlers": {
        "console": {
            "level": "INFO",
            "formatter": "simple",
            "class": "opentelemetry.sdk._logs.LoggingHandler",
            "logger_provider": logger_provider,
        }
    },
    "loggers": {
        "__main__": {"handlers": ["console"], "level": "INFO"},
    }
})

however with autoinstrumentation sometimes this is not possible.

Describe the solution you'd like

We should have a way to configure logging level and format using autoinstrumentation (most likely with env vars), similarly to how opentelemetry-instrumetation-logging does.

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

None

@jeremydvoss
Copy link
Contributor

Manual instrumentation formatting merged in #4166 (variation of pr mentioned in this description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-instrumentation related to auto-instrumentation of the sdk feature-request logging
Projects
Status: To do
2 participants