what's log4j actually doing when we turn on or off some log places?

后端 未结 3 1828
礼貌的吻别
礼貌的吻别 2021-01-04 18:02

We know we can config log4j to turn off log on specific places (class or package in Java) via its properties/configuration file. My questions are followed:

  1. wha
3条回答
  •  春和景丽
    2021-01-04 18:49

    1. log4j will process the log statement, and check to see if the particular logger is enabled at the particular logging level. If it is not, then the statement will not be logged.

    2. These checks are significantly less expensive than the actual writing to disk (or console), but they still have an impact.

    3. no, java has no such concept as #ifdef (out of the box anyway, there are java precompilers out there)

提交回复
热议问题