0

While capturing http requests of webservice from website backend seeing some logs are in different format. I'm using python logging as a format:

logging.basicConfig(format='%(asctime)s %(levelname)-4s %(message)s', 
                    level=logging.INFO,
                    datefmt='%Y-%m-%d %H:%M:%S'`enter code here`, 
                    filemode='a')

logging.info("%3s %s %s", request.response.status_code, driver.current_url, request.path)

Just expect to see as an output:

2020-02-10 14:00:56 INFO  204   https://driver.current_url         https://request_path

but besides this format, different log formats are also seen as shown below:

2020-02-10 13:35:08 INFO  Capturing request: https://request_path 
2020-02-10 13:35:08 INFO  Capturing response: https://request_path 200 OK 

Can anyone help me that why seeing these logs?

stacktome
  • 790
  • 2
  • 9
  • 32

1 Answers1

0

Python has the possibility to have multiple loggers. basicConfig configures the root logger, but it's possible other libraries configure their own loggers.

In order to configure those loggers, you would need to know the library's logger's name and call "getLogger(" the name ")" in order to get the logger to be able to configure it.

Please see Python's logging cookbook for more info.

Sam
  • 794
  • 1
  • 7
  • 26