8000 werkzeug logs are filtered out by default · Issue #713 · googleapis/python-logging · GitHub
[go: up one dir, main page]

Skip to content
werkzeug logs are filtered out by default #713
Closed
@stewartmiles

Description

@stewartmiles

Environment details

  • OS type and version: Google Cloud Container Optimized OS (gke-12314-gke401-cos-93-16623-295-14-v221129-c-pre)

  • Python version: 3.8.10

  • pip version: 22.3.1

  • google-cloud-logging version: 3.4.0

Steps to reproduce

  1. Either use werkzeug for serving or configure a werkzeug logger
  2. Setup a Google Cloud Logging Python client
  3. Log to the werkzeug logger and notice that logs are not sent to Google Cloud Logging.

Code example

import logging
import google.cloud.logging

logger = logging.getLogger('werkzeug')

client = google.cloud.logging.Client()
client.setup_logging()
logger.info('hello from werkzeug')
logging.info('hello from the root logger')

This results in hello from werkzeug not being set to the global log.

Due to EXCLUDED_LOGGER_DEFAULTS werkzeug is excluded from the set of loggers that are sent to Google Cloud logging:

"""Exclude internal logs from propagating through handlers"""
EXCLUDED_LOGGER_DEFAULTS = (
"google.cloud",
"google.auth",
"google_auth_httplib2",
"google.api_core.bidi",
"werkzeug",

google.cloud.logging.Client.setup_logging() has an excluded_loggers kwarg but setting that does not change the set of loggers that are ignored by the library due to the default set being added back into the set of ignored loggers in

all_excluded_loggers = set(excluded_loggers + EXCLUDED_LOGGER_DEFAULTS)

The only workaround is to patch EXCLUDED_LOGGER_DEFAULTS to remove werkzeug from the list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: loggingIssues related to the googleapis/python-logging API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0