5

I use selenium with Scrapy and it produces way too much logs. enter image description here I tried several solutions offered at SO before but none of them worked. Basically I tried disabling it in options and passing service-argument to write log into file. In both cases the log is still printed while executed. How do I fix it?

options = Options()
options.headless = True
# options.add_argument('--disable-logging')
self.driver = webdriver.Chrome(r'C:\Python3\selenium\webdriver\chromedriver_win32\chromedriver.exe', chrome_options=options, service_args=["--verbose", "--log-path=D:\\qc1.log"])   

I also tried settings service-path to NULL (I run windows)

self.driver = `webdriver.Chrome(r'C:\Python3\selenium\webdriver\chromedriver_win32\chromedriver.exe', chrome_options=options, service_log_path='NUL')`

SOLUTION: Thanks to - @Manmohan_singh and The only working answer so far add this

chrome_options.add_argument("--log-level=3") to shut the logging.
self.driver = webdriver.Chrome(r'C:\Python3\selenium\webdriver\chromedriver_win32\chromedriver.exe', chrome_options=options) 

Hope this will be useful in future, since none of the presumably duplicate topics did help me and Stack moderators do not seem to read the posts carefully.

Billy Jhon
  • 1,035
  • 15
  • 30
  • @DebanjanB as you can see from the body of the question, i have tried those and it still does not work. – Billy Jhon Dec 13 '18 at 13:06
  • The expectation on Stack Overflow is that the user asking a question not only does research to answer their own question but also shares that research, code attempts, and results. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! See also: [How to Ask](https://stackoverflow.com/help/how-to-ask) – undetected Selenium Dec 13 '18 at 13:24
  • @DebanjanB SO? i have shared my variations of code and snippet of the problem that shows i did try to apply what i have researched. What is your point here? – Billy Jhon Dec 13 '18 at 14:24
  • Here most of us are developers and want to keep [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself). See: [How do I do X?](https://meta.stackoverflow.com/questions/253069/whats-the-appropriate-new-current-close-reason-for-how-do-i-do-x) – undetected Selenium Dec 13 '18 at 14:53
  • @Billy Jhon ...and 2 years later this just helped me. Cheers Mate! – Alejandro Suarez May 23 '20 at 18:52

0 Answers0