[go: up one dir, main page]

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

Make flush method not shutdown #38

Open
rjurney opened this issue May 2, 2017 · 3 comments
Open

Make flush method not shutdown #38

rjurney opened this issue May 2, 2017 · 3 comments

Comments

@rjurney
Copy link
rjurney commented May 2, 2017

I need my messages to flush after each send, but your flush method shuts down. Can you change this?

@kislyuk
Copy link
Owner
kislyuk commented May 3, 2017

As a quick workaround for flush not doing what you want, you can use use_queues=False when constructing the log handler to make each log message trigger a log delivery API call.

@kislyuk
Copy link
Owner
kislyuk commented May 3, 2017

I agree in general that the semantics of flush() as specified by https://docs.python.org/3/library/logging.html#logging.Handler.flush mean it should not trigger shutdown by default.

@terencehonles
Copy link
Contributor
terencehonles commented Jan 23, 2021

@kislyuk do you know if this is still the case? It looks like it's not since flush looks like it just puts a sentinel on the queue and will force the queues to send when they see it but they continue monitoring the queue after that:

def flush(self):
"""
Send any queued messages to CloudWatch. This method does nothing if ``use_queues`` is set to False.
"""
# fixme: don't add filter if it's already installed
self.addFilter(_boto_filter)
if self.shutting_down:
return
for q in self.queues.values():
q.put(self.FLUSH)
for q in self.queues.values():
q.join()

and

while msg != self.END:
cur_batch = [] if msg is None or msg == self.FLUSH else [msg]

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

3 participants