Open
Conversation
Owner
|
Thanks! I'm okay with your proposal. I'll look into it then merge. |
Author
|
Thanks, for permission. I've released your module as part of my AlexBerUtils project, see https://github.com/alex-ber/AlexBerUtils/blob/master/alexber/utils/stdlogging.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I will be glad to receive permission from you to redistribute my code based on your.
I have come across your repository here https://stackoverflow.com/questions/47325506/making-python-loggers-log-all-stdout-and-stderr-messages. Quote from their: " But be careful to capture stdout because it's very fragile."
I decided to focus on redirecting stderr only to the logger. If you want you can also redirect stdout, by making 2 calls to
initStream()package-level method. But, because of https://unix.stackexchange.com/questions/616616/separate-stdout-and-stderr-for-docker-run it is sufficient only to do it for stderr for me (I'm running my application insider Docker container using tty).Usage example:
logging.config.dictConfig(kwargs[conf.GENERAL_KEY][conf.LOG_KEY]) errLogger = logging.getLogger("stderr") stdlogging.initStream(errLogger)Configuration file (simplified):
`
general:
`
The essential part is
stderr: handlers: [stderr_handler, stderr_console_handler] propagate: False