0
from my_stream import custom_stream
stream = custom_stream()
for i in os.listdir('html_files'):
    stream.get_im(i)

Output

l2020-06-25 09:01:54 [urllib3.connectionpool] DEBUG: http://127.0.0.1:33987 "POST /session/6d9d82226d6f55d263f86812c4893958/element HTTP/1.1" 200 88
2020-06-25 09:01:54 [selenium.webdriver.remote.remote_connection] DEBUG: Finished Request
2020-06-25 09:01:54 [selenium.webdriver.remote.remote_connection] DEBUG: GET http://127.0.0.1:33987/session/6d9d82226d6f55d263f86812c4893958/element/e5d1254d-6dbf-4539-a4bc-6c533fe8918d/screenshot {"id": "e5d1254d-6dbf-4539-a4bc-6c533fe8918d"}
2020-06-25 09:01:55 [urllib3.connectionpool] DEBUG: http://127.0.0.1:33987 "GET /session/6d9d82226d6f55d263f86812c4893958/element/e5d1254d-6dbf-4539-a4bc-6c533fe8918d/screenshot HTTP/1.1" 200 3397480
2020-06-25 09:01:55 [selenium.webdriver.remote.remote_connection] DEBUG: Finished Request
2020-06-25 09:01:55 [PIL.PngImagePlugin] DEBUG: STREAM b'IHDR' 16 13
2020-06-25 09:01:55 [PIL.PngImagePlugin] DEBUG: STREAM b'sRGB' 41 1
2020-06-25 09:01:55 [PIL.PngImagePlugin] DEBUG: STREAM b'IDAT' 54 8192
2020-06-25 09:01:56 [selenium.webdriver.remote.remote_connection] DEBUG: POST http://127.0.0.1:50869/session/29bee4ee8c77c76473d09818581277ab/url {"url": "file:///home/usr/html_files/172e63.html"}

I don't have any logging happening in custom_stream class, How can I mute this when I run it?

custom_stream uses selenium to get images and then PIL to do some image processing

goku
  • 183
  • 14

1 Answers1

1

Try this:

import logging
from selenium.webdriver.remote.remote_connection import LOGGER
LOGGER.setLevel(logging.WARNING)

If that doesn't work, please make a Minimal, Reproducible Example

Be Chiller Too
  • 2,502
  • 2
  • 16
  • 42
  • I don't know for sure, try my solution, if it works, mark my solution as Accepted, if it doesn't we'll keep looking – Be Chiller Too Jun 25 '20 at 09:13
  • `logger = logging.getLogger('selenium.webdriver.remote.remote_connection') logger.setLevel(logging.WARNING)` this mutes most messages – goku Jun 25 '20 at 09:31
  • no, not yet, fewer messages are print with this solution but still gives DEBUG – goku Jun 25 '20 at 09:47
  • You can also try to mute the following loggers: "urllib3.connectionpool" and "PIL.PngImagePlugin" – Be Chiller Too Jun 25 '20 at 10:30
  • 1
    Yes that was the fix (logger warning on every module I used), Thanks a lot. – goku Jun 26 '20 at 00:51