Log4jOverridableConfigurer implements BeanPostProcessor, PriorityOrdered, ApplicationContextAware { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (!loggingInitialized) { initLogging(); loggingInitialized = true; } return bean; }  @Override Object postProcessBeforeInitialization(Object bean, String beanName); @Override Object postProcessAfterInitialization(Object bean, String beanName); @Override int getOrder(); @Override void setApplicationContext(ApplicationContext applicationContext); void setOverrideResourceLocation(String overrideResourceLocation); void setDefaultResourceLocation(String defaultResourceLocation); void setTableName(String tableName); void setSelectColumn(String selectColumn); void setWhereColumn(String whereColumn); void setWhereValue(String whereValue); void setDataSource(DataSource dataSource);  }
@Test public void testLog4JDbOverrideConfigurationClob() throws Exception { Path configPath = getRandomLog4jConfigPath(); Path outputPath = getRandomLog4jOutputPath(); String configKey = null; try { configKey = ConfigurationValue.LOG4J_OVERRIDE_CONFIGURATION.getKey() + UUID.randomUUID().toString().substring(0, 5); insertDbLog4JConfigurationFromResourceLocation(LOG4J_CONFIG_FILENAME, 0, outputPath, ConfigurationEntity.COLUMN_VALUE_CLOB, configKey); loggingHelper.shutdownLogging(); Log4jOverridableConfigurer log4jConfigurer = getLog4jOverridableConfigurerForDb(configKey); log4jConfigurer.postProcessBeforeInitialization(null, null); assertTrue("Log4J output file doesn't exist, but should.", Files.exists(outputPath)); } finally { cleanup(configPath, outputPath); deleteDbLog4JConfiguration(configKey); } }
@Test public void testLog4JDbWithRefreshInterval() throws Exception { Path configPath = getRandomLog4jConfigPath(); Path outputPath = getRandomLog4jOutputPath(); String configKey = null; try { configKey = ConfigurationValue.LOG4J_OVERRIDE_CONFIGURATION.getKey() + UUID.randomUUID().toString().substring(0, 5); insertDbLog4JConfigurationFromResourceLocation(DaoEnvTestSpringModuleConfig.TEST_LOG4J_CONFIG_RESOURCE_LOCATION, 1, outputPath, ConfigurationEntity.COLUMN_VALUE_CLOB, configKey); loggingHelper.shutdownLogging(); Log4jOverridableConfigurer log4jConfigurer = getLog4jOverridableConfigurerForDb(configKey); log4jConfigurer.postProcessBeforeInitialization(null, null); assertTrue("Log4J output file exists, but shouldn't.", Files.notExists(outputPath)); updateDbLog4JConfigurationFromResourceLocation(LOG4J_CONFIG_FILENAME, outputPath, ConfigurationEntity.COLUMN_VALUE_CLOB, configKey); Thread.sleep(3000); assertTrue("Log4J output file doesn't exist, but should.", Files.exists(outputPath)); } finally { cleanup(configPath, outputPath); deleteDbLog4JConfiguration(configKey); } }