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

Duplicated logsß #1

Open
buhtz opened this issue Apr 22, 2023 · 3 comments
Open

Duplicated logsß #1

buhtz opened this issue Apr 22, 2023 · 3 comments

Comments

@buhtz
Copy link

buhtz commented Apr 22, 2023

Hi,

you pointed to that piece of code in an StackOverflow comment.

log = logging.getLogger(app_name)
stderr_handler = _stream_handler(logstream=sys.stderr, loglevel=logging.DEBUG, logname='stderr')
log.addHandler(stderr_handler)
stdout_handler = _stream_handler(
logstream=sys.stdout, loglevel=logging.INFO, logname='stdout', logfilters=[MaxLevelFilter(logging.INFO)]
)

I'm not sure if I get it right here. But doesn't this produce duplicated logs between stdout and stderr?
The stderr handle does log everything (all levels) to stderr not matter if the stdout handle does log something to stdout.

@canepan
Copy link
Owner

canepan commented Apr 22, 2023

That's why I am using the MaxLevelFilter

@buhtz
Copy link
Author

buhtz commented Apr 22, 2023

Sorry, I don't get it.
You mean stdout just catch INFO messages?

But doesn't stderr also catch them?

@canepan
Copy link
Owner

canepan commented Apr 22, 2023 via email

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