ExceptionLogger implements InitializingBean { @Override public void afterPropertiesSet() { validateLogMessageFormat(logMessageFormat); if (exceptionLevelResolver == null) { exceptionLevelResolver = new DefaultExceptionLevelResolver(exceptionCodeResolver); } registerExceptionLevelLoggers(ExceptionLevel.INFO, infoLogger); registerExceptionLevelLoggers(ExceptionLevel.WARN, warnLogger); registerExceptionLevelLoggers(ExceptionLevel.ERROR, errorLogger); } ExceptionLogger();  ExceptionLogger(String name); void setExceptionCodeResolver(
            ExceptionCodeResolver exceptionCodeResolver); void setExceptionLevelResolver(
            ExceptionLevelResolver exceptionLevelResolver); void setLogMessageFormat(String logMessageFormat); void setTrimLogMessage(boolean trimLogMessage); void setDefaultCode(String defaultCode); void setDefaultMessage(String defaultMessage); @Override void afterPropertiesSet(); void log(Exception ex); void info(Exception ex); void warn(Exception ex); void error(Exception ex);  }
@Test public void testAfterPropertiesSet() throws Exception { applicationLogger.setLevel(Level.INFO); monitoringLogger.setLevel(Level.INFO); Exception ex = new SystemException("i.code01", "system error."); ExceptionCodeResolver mockExceptionCodeResolver = mock( ExceptionCodeResolver.class); when(mockExceptionCodeResolver.resolveExceptionCode(ex)).thenReturn( "i.code01"); testTarget.setExceptionCodeResolver(mockExceptionCodeResolver); testTarget.setExceptionLevelResolver(null); testTarget.afterPropertiesSet(); testTarget.log(ex); String expectedLogMessage = "[i.code01] system error."; verifyLogging(expectedLogMessage, Level.INFO, ex, mockApplicationLoggerAppender); verifyLogging(expectedLogMessage, Level.INFO, mockMonitoringLoggerAppender); }