class logging.Logger
propagate

If this attribute evaluates to true, events logged to this logger will be passed to the handlers of higher level (ancestor) loggers, in addition to any handlers attached to this logger. Messages are passed directly to the ancestor loggers’ handlers - neither the level nor filters of the ancestor loggers in question are considered.

If this evaluates to false, logging messages are not passed to the handlers of ancestor loggers.

The constructor sets this attribute to True.


Logger의 propagate의 default value는 True이다


propagate=True이면, higher level logger's handlers에게 logging이 passing된다


level이나, handler에 대한 처리순서는 다음과 같다


log = logging.getLogger('test')


log.debug('hello')



1. log에서 처리 (log.level이 debug보다 높을경우 종료, 즉 handler도 패스되지 않음)

2. log's handlers에서 처리 (각 handlers의 level에 따라 처리)

3. log's ancestors's handlers (마찬가지로 각 handlers의 level의 따라 처리) (ancestors logger는 거치지않음)


logger들은 입구이고, handler들은 출구이다


---


logger의 level이 NOTSET일 경우에는, 아무 로그도 처리하지 않는다

handler의 level이 NOTSET일 경우에는, 모든 로그를 처리한다



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/