问题描述
例如,我想在编译之前替换:
#debug("${enclosing_method} this is debug message for " + userName)
with:
if (log.isDebugEnabled()) { log.debug("<real method name> this is debug message for " + userName); }
推荐答案
.其他推荐答案
考虑使用 log4j 如果您的示例反映了您的主要目标.
需要报价:所需的报价:preprocorsorser用法不好练习也可能感兴趣.
问题描述
for example I want to replace before compilation:
#debug("${enclosing_method} this is debug message for " + userName)
with:
if (log.isDebugEnabled()) { log.debug("<real method name> this is debug message for " + userName); }
推荐答案
Don't. Use slf4j instead which allows you to avoid the check with {}.
其他推荐答案
Consider using log4j if your example reflects your primary aim.
Quote needed: Preprocessor usage is bad OO practice could be of interest as well.