如何在Junit中使_logger.isDebugEnabled()
条件为false?
private static final Logger _logger = Logger.getLogger(InstanceReleaseMachine.class);
if (_logger.isDebugEnabled())
{
_logger.debug("Error from Releasing Instance: " + failure);
}
据我所知,我无法做到,如果有人这样做,请告诉我。
答案 0 :(得分:1)
您可以在单元测试中以编程方式设置level = OFF:
Logger.getRootLogger().setLevel(Level.OFF);