private void configureLogging() { if (loggingConfig != null) { loggingConfig.setProperties(globalProperties); LoggingConfigurator.apply(loggingConfig); } }
private Batch(Builder builder) { components = new ArrayList<>(); components.addAll(builder.components); if (builder.environment != null) { components.add(builder.environment); } if (builder.globalProperties != null) { globalProperties.putAll(builder.globalProperties); } if (builder.isEnableLoggingConfiguration()) { loggingConfig = new LoggingConfiguration(builder.environment).setProperties(globalProperties); if (builder.logOutput != null) { loggingConfig.setLogOutput(builder.logOutput); } } }
@Test public void testSetVerboseAnalysis() { Map<String, String> props = Maps.newHashMap(); LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(props); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT); props.put("sonar.verbose", "true"); conf.setProperties(props); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_VERBOSE); }
@Test public void test_log_level_property() { Map<String, String> properties = Maps.newHashMap(); LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("INFO"); properties.put("sonar.log.level", "INFO"); conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("INFO"); properties.put("sonar.log.level", "DEBUG"); conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("DEBUG"); properties.put("sonar.log.level", "TRACE"); conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("DEBUG"); }
@Test public void test_deprecated_log_properties() { Map<String, String> properties = Maps.newHashMap(); assertThat(new LoggingConfiguration(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT); properties.put("sonar.verbose", "true"); LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_VERBOSE); properties.put("sonar.verbose", "false"); conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT); properties.put("sonar.verbose", "false"); properties.put("sonar.log.profilingLevel", "FULL"); conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("DEBUG"); properties.put("sonar.verbose", "false"); properties.put("sonar.log.profilingLevel", "BASIC"); conf = new LoggingConfiguration(null).setProperties(properties); assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("DEBUG"); }
private void configureLogging() { if (loggingConfig != null) { loggingConfig.setProperties(globalProperties); LoggingConfigurator.apply(loggingConfig); } }
private void configureTaskLogging(Map<String, String> taskProperties) { if (loggingConfig != null) { loggingConfig.setProperties(taskProperties, bootstrapProperties); LoggingConfigurator.apply(loggingConfig); } }
private void configureLogging() { if (loggingConfig != null) { loggingConfig.setProperties(bootstrapProperties); LoggingConfigurator.apply(loggingConfig); } }
private Batch(Builder builder) { components = Lists.newArrayList(); components.addAll(builder.components); if (builder.environment != null) { components.add(builder.environment); } if (builder.bootstrapProperties != null) { bootstrapProperties.putAll(builder.bootstrapProperties); } if (builder.isEnableLoggingConfiguration()) { logging = LoggingConfiguration.create(builder.environment).setProperties(bootstrapProperties); } }
private Batch(Builder builder) { components = new ArrayList<>(); components.addAll(builder.components); if (builder.environment != null) { components.add(builder.environment); } if (builder.globalProperties != null) { globalProperties.putAll(builder.globalProperties); } if (builder.isEnableLoggingConfiguration()) { loggingConfig = new LoggingConfiguration(builder.environment).setProperties(globalProperties); if (builder.logOutput != null) { loggingConfig.setLogOutput(builder.logOutput); } } }
private Batch(Builder builder) { components = Lists.newArrayList(); components.addAll(builder.components); if (builder.environment != null) { components.add(builder.environment); } if (builder.bootstrapProperties != null) { bootstrapProperties.putAll(builder.bootstrapProperties); } if (builder.isEnableLoggingConfiguration()) { loggingConfig = new LoggingConfiguration(builder.environment).setProperties(bootstrapProperties); if (builder.logOutput != null) { loggingConfig.setLogOutput(builder.logOutput); } } }