문제 설명
Selenium‑wire Python을 사용하여 네트워크 트래픽을 캡처하는 동안 다른 형식의 로그 보기 (Seeing logs in a different format while capturing network traffic using selenium‑wire python)
웹 사이트 백엔드에서 웹 서비스의 http 요청을 캡처하는 동안 일부 로그가 다른 형식으로 표시됩니다. 저는 python 로깅을 형식으로 사용하고 있습니다.
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)
출력으로 표시될 것으로 예상됩니다.
2020‑02‑10 14:00:56 INFO 204 https://driver.current_url https://request_path
그러나 이 형식 외에 다른 로그 형식도 아래와 같이 표시됩니다.
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
이 로그를 보는 이유를 알려줄 수 있는 사람이 있습니까?
참조 솔루션
방법 1:
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.
(by sophie_den、Sam)