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:
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.
These checks are significantly less expensive than the actual writing to disk (or console), but they still have an impact.
no, java has no such concept as #ifdef (out of the box anyway, there are java precompilers out there)