Selenium + python automation 12+ log logging basic usage, Advanced Usage

1. Keyword:

  login login
  log log
  logging python logging module

2. What is the log:

Log used to record user behavior or execution of the code

3. The use of local logs:
  1. troubleshooting when you need to print a lot of details to help troubleshoot
  2. There are a number of user behavior, there is nothing wrong to be recorded (backstage)
  3. serious error record

Log level 4.logging module

 

Two Types of Writing format:

Formats:

Format II:

 

 Log Output

 

In the above list the log from top to bottom level is elevated, i.e.: DEBUG <INFO <WARNING <ERROR <CRITICAL, the log information is sequentially reduced;

 

problem:

Question 1: Why did the previous two logs are not printed out?

  This is because the logging level log record function logging module to be used provided that WARNING, so only level WARNING logging and greater than its ERROR and CRITICAL levels of logging is outputted, while less than its DEBUG and INFO logging level is discarded.

Question 2: The default print out the log information in the fields What does it mean? Why is this output?

 The meaning of each field above the output of each row are logging: Log Level: Log name: Log Content

Question 3: how to modify logging these default settings do?

  Actually very simple, before we call these logging functions above, manually call it basicConfig () method, we want to set the content passed as parameters into it.

Guess you like

Origin www.cnblogs.com/liunaixu/p/11078569.html