开发者

Preprocessor logging statements in java

开发者 https://www.devze.com 2023-01-20 05:17 出处:网络
for example I want to replace before compilation: #debug(\"${enclosing_method} this is debug message for \" + u开发者_如何学PythonserName)

for example I want to replace before compilation:

#debug("${enclosing_method} this is debug message for " + u开发者_如何学PythonserName)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消