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

Setting stream_name in handler used in basicConfig causes all downstream modules to not log to CloudWatch #94

Open
et304383 opened this issue Apr 9, 2020 · 1 comment

Comments

@et304383
Copy link

et304383 commented Apr 9, 2020

If I have a root module with code like this:

import mymodule

cw_handler = watchtower.CloudWatchLogHandler(
    log_group=os.environ['LOG_GROUP'],
    stream_name=os.environ['INSTANCE_ID'],
    send_interval=5,
    log_group_retention_days=14
)
console_handler = logging.StreamHandler()

logging.basicConfig(
    level=os.getenv('LOG_LEVEL', logging.INFO),
    handlers=[cw_handler, console_handler]
)

logger = logging.getLogger(__name__)

And then in mymodule.py:

logger = logging.getLogger(__name__)

CW logs are emitted for the root module but nothing shows up for any of the submodules under the stream.

If I omit the stream name parameter, then obviously it works, but logs go to a separate stream per module, which I do not want.

Edit: upon looking for help in other possibly similar issues, I discovered this comment. I set use_queues to False and it works.

Seems this queueing logic is causing a lot of problems.

@petero-dk
Copy link

We have this exact issue, confirmed on Django 1.11 running on Python 2.7 (yes old we know)

This however did not show up on Django 1.2.

This also mostly seem to be a problem when running Celery via Django or Django via uwsgi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants