Java Code Examples for org.apache.logging.log4j.util.Strings#trimToNull()
The following examples show how to use
org.apache.logging.log4j.util.Strings#trimToNull() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PoolableConnectionFactoryConfig.java From logging-log4j2 with Apache License 2.0 | 6 votes |
private PoolableConnectionFactoryConfig(final boolean cacheState, final Collection<String> connectionInitSqls, final Boolean defaultAutoCommit, final String defaultCatalog, final Integer defaultQueryTimeoutSeconds, final Boolean defaultReadOnly, final int defaultTransactionIsolation, final Collection<String> disconnectionSqlCodes, final boolean enableAutoCommitOnReturn, final boolean fastFailValidation, final long maxConnLifetimeMillis, final int maxOpenPreparedStatements, final boolean poolStatements, final boolean rollbackOnReturn, final String validationQuery, final int validationQueryTimeoutSeconds) { super(); this.cacheState = cacheState; this.connectionInitSqls = connectionInitSqls; this.defaultAutoCommit = defaultAutoCommit; this.defaultCatalog = Strings.trimToNull(defaultCatalog); this.defaultQueryTimeoutSeconds = defaultQueryTimeoutSeconds; this.defaultReadOnly = defaultReadOnly; this.defaultTransactionIsolation = defaultTransactionIsolation; this.disconnectionSqlCodes = disconnectionSqlCodes; this.autoCommitOnReturn = enableAutoCommitOnReturn; this.fastFailValidation = fastFailValidation; this.maxConnLifetimeMillis = maxConnLifetimeMillis; this.maxOpenPreparedStatements = maxOpenPreparedStatements; this.poolStatements = poolStatements; this.rollbackOnReturn = rollbackOnReturn; this.validationQuery = Strings.trimToNull(validationQuery); this.validationQueryTimeoutSeconds = validationQueryTimeoutSeconds; }
Example 2
Source File: PropertiesConfigurationBuilder.java From logging-log4j2 with Apache License 2.0 | 5 votes |
private AppenderRefComponentBuilder createAppenderRef(final String key, final Properties properties) { final String ref = (String) properties.remove("ref"); if (Strings.isEmpty(ref)) { throw new ConfigurationException("No ref attribute provided for AppenderRef " + key); } final AppenderRefComponentBuilder appenderRefBuilder = builder.newAppenderRef(ref); final String level = Strings.trimToNull((String) properties.remove("level")); if (!Strings.isEmpty(level)) { appenderRefBuilder.addAttribute("level", level); } return addFiltersToComponent(appenderRefBuilder, properties); }
Example 3
Source File: PropertiesConfigurationBuilder.java From logging-log4j2 with Apache License 2.0 | 5 votes |
private LoggerComponentBuilder createLogger(final String key, final Properties properties) { final String name = (String) properties.remove(CONFIG_NAME); final String location = (String) properties.remove("includeLocation"); if (Strings.isEmpty(name)) { throw new ConfigurationException("No name attribute provided for Logger " + key); } final String level = Strings.trimToNull((String) properties.remove("level")); final String type = (String) properties.remove(CONFIG_TYPE); final LoggerComponentBuilder loggerBuilder; boolean includeLocation; if (type != null) { if (type.equalsIgnoreCase("asyncLogger")) { if (location != null) { includeLocation = Boolean.parseBoolean(location); loggerBuilder = builder.newAsyncLogger(name, level, includeLocation); } else { loggerBuilder = builder.newAsyncLogger(name, level); } } else { throw new ConfigurationException("Unknown Logger type " + type + " for Logger " + name); } } else { if (location != null) { includeLocation = Boolean.parseBoolean(location); loggerBuilder = builder.newLogger(name, level, includeLocation); } else { loggerBuilder = builder.newLogger(name, level); } } addLoggersToComponent(loggerBuilder, properties); addFiltersToComponent(loggerBuilder, properties); final String additivity = (String) properties.remove("additivity"); if (!Strings.isEmpty(additivity)) { loggerBuilder.addAttribute("additivity", additivity); } return loggerBuilder; }
Example 4
Source File: PropertiesConfigurationBuilder.java From logging-log4j2 with Apache License 2.0 | 5 votes |
private RootLoggerComponentBuilder createRootLogger(final Properties properties) { final String level = Strings.trimToNull((String) properties.remove("level")); final String type = (String) properties.remove(CONFIG_TYPE); final String location = (String) properties.remove("includeLocation"); final boolean includeLocation; final RootLoggerComponentBuilder loggerBuilder; if (type != null) { if (type.equalsIgnoreCase("asyncRoot")) { if (location != null) { includeLocation = Boolean.parseBoolean(location); loggerBuilder = builder.newAsyncRootLogger(level, includeLocation); } else { loggerBuilder = builder.newAsyncRootLogger(level); } } else { throw new ConfigurationException("Unknown Logger type for root logger" + type); } } else { if (location != null) { includeLocation = Boolean.parseBoolean(location); loggerBuilder = builder.newRootLogger(level, includeLocation); } else { loggerBuilder = builder.newRootLogger(level); } } addLoggersToComponent(loggerBuilder, properties); return addFiltersToComponent(loggerBuilder, properties); }