0

When I use logging, I get duplicate entries in the log, like this:

[2022-09-22 11:35:32,079] [INFO] [My App] going to get milk...
App 13621 output: [ pid=13621, time=2022-09-22 11:35:32,079 ]: going to get milk...

The second entry, I don't need; it makes the log harder to read.

I have in the past used a log filter command:

warnings.filterwarnings('ignore', message='Unverified HTTPS request')

but I don't know how to apply a similar technique to this situation. I'm not sure where the duplicate is coming from so I don't know what to talk to to suppress it.

toddmo
  • 20,682
  • 14
  • 97
  • 107

1 Answers1

0

OK I fixed it by setting:

logger.propagate = False

in my logger setup code.

I found the answer here, and it may be a duplicate question, but the search terms are completely different. I had to figure out stdout was involved and search on that term before I found that other solution. Simply searching on the problem symptoms doesn't land you on that page.

toddmo
  • 20,682
  • 14
  • 97
  • 107