例如我想在编译之前替换:
#debug("${enclosing_method} this is debug message for " + userName)
使用:
if (log.isDebugEnabled())
{
log.debug("<real method name> this is debug message for " + userName);
}
答案 0 :(得分:5)
别。请使用slf4j,这样可以避免使用{}。
进行检查答案 1 :(得分:2)
如果您的示例反映了您的主要目标,请考虑使用log4j。
Quote needed: Preprocessor usage is bad OO practice也可能会引起人们的兴趣。