本文整理汇总了Java中org.apache.logging.log4j.core.appender.AbstractAppender.parseInt方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractAppender.parseInt方法的具体用法?Java AbstractAppender.parseInt怎么用?Java AbstractAppender.parseInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.logging.log4j.core.appender.AbstractAppender
的用法示例。
在下文中一共展示了AbstractAppender.parseInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newInstance
import org.apache.logging.log4j.core.appender.AbstractAppender; //导入方法依赖的package包/类
/**
* Gets an instance of the class.
*
* @param config The current Configuration.
* @param options pattern options, an array of two elements: pattern, max length (defaults to 100 on invalid value).
* @return instance of class.
*/
public static MaxLengthConverter newInstance(final Configuration config, final String[] options) {
if (options.length != 2) {
LOGGER.error("Incorrect number of options on maxLength: expected 2 received {}: {}", options.length,
options);
return null;
}
if (options[0] == null) {
LOGGER.error("No pattern supplied on maxLength");
return null;
}
if (options[1] == null) {
LOGGER.error("No length supplied on maxLength");
return null;
}
final PatternParser parser = PatternLayout.createPatternParser(config);
final List<PatternFormatter> formatters = parser.parse(options[0]);
return new MaxLengthConverter(formatters, AbstractAppender.parseInt(options[1], 100));
}
示例2: createAppender
import org.apache.logging.log4j.core.appender.AbstractAppender; //导入方法依赖的package包/类
/**
* Factory method for creating a JDBC appender within the plugin manager.
*
* @see Builder
* @deprecated use {@link #newBuilder()}
*/
@Deprecated
public static <B extends Builder<B>> JdbcAppender createAppender(final String name, final String ignore,
final Filter filter,
final ConnectionSource connectionSource,
final String bufferSize, final String tableName,
final ColumnConfig[] columnConfigs) {
Assert.requireNonEmpty(name, "Name cannot be empty");
Objects.requireNonNull(connectionSource, "ConnectionSource cannot be null");
Assert.requireNonEmpty(tableName, "Table name cannot be empty");
Assert.requireNonEmpty(columnConfigs, "ColumnConfigs cannot be empty");
final int bufferSizeInt = AbstractAppender.parseInt(bufferSize, 0);
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
return JdbcAppender.<B>newBuilder()
.setBufferSize(bufferSizeInt)
.setColumnConfigs(columnConfigs)
.setConnectionSource(connectionSource)
.setTableName(tableName)
.withName(name)
.withIgnoreExceptions(ignoreExceptions)
.withFilter(filter)
.build();
}
示例3: createAppender
import org.apache.logging.log4j.core.appender.AbstractAppender; //导入方法依赖的package包/类
/**
* Factory method for creating a NoSQL appender within the plugin manager.
*
* @param name The name of the appender.
* @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
* they are propagated to the caller.
* @param filter The filter, if any, to use.
* @param bufferSize If an integer greater than 0, this causes the appender to buffer log events and flush whenever
* the buffer reaches this size.
* @param provider The NoSQL provider that provides connections to the chosen NoSQL database.
* @return a new NoSQL appender.
*/
@PluginFactory
public static NoSQLAppender createAppender(
@PluginAttribute("name") final String name,
@PluginAttribute("ignoreExceptions") final String ignore,
@PluginElement("Filter") final Filter filter,
@PluginAttribute("bufferSize") final String bufferSize,
@PluginElement("NoSqlProvider") final NoSQLProvider<?> provider) {
if (provider == null) {
LOGGER.error("NoSQL provider not specified for appender [{}].", name);
return null;
}
final int bufferSizeInt = AbstractAppender.parseInt(bufferSize, 0);
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
final String managerName = "noSqlManager{ description=" + name + ", bufferSize=" + bufferSizeInt
+ ", provider=" + provider + " }";
final NoSQLDatabaseManager<?> manager = NoSQLDatabaseManager.getNoSQLDatabaseManager(
managerName, bufferSizeInt, provider
);
if (manager == null) {
return null;
}
return new NoSQLAppender(name, filter, ignoreExceptions, manager);
}
示例4: createAppender
import org.apache.logging.log4j.core.appender.AbstractAppender; //导入方法依赖的package包/类
/**
* Factory method for creating a JDBC appender within the plugin manager.
*
* @param name The name of the appender.
* @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
* they are propagated to the caller.
* @param filter The filter, if any, to use.
* @param connectionSource The connections source from which database connections should be retrieved.
* @param bufferSize If an integer greater than 0, this causes the appender to buffer log events and flush whenever
* the buffer reaches this size.
* @param tableName The name of the database table to insert log events into.
* @param columnConfigs Information about the columns that log event data should be inserted into and how to insert
* that data.
* @return a new JDBC appender.
*/
@PluginFactory
public static JDBCAppender createAppender(
@PluginAttribute("name") final String name,
@PluginAttribute("ignoreExceptions") final String ignore,
@PluginElement("Filter") final Filter filter,
@PluginElement("ConnectionSource") final ConnectionSource connectionSource,
@PluginAttribute("bufferSize") final String bufferSize,
@PluginAttribute("tableName") final String tableName,
@PluginElement("ColumnConfigs") final ColumnConfig[] columnConfigs) {
final int bufferSizeInt = AbstractAppender.parseInt(bufferSize, 0);
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
final StringBuilder managerName = new StringBuilder("jdbcManager{ description=").append(name)
.append(", bufferSize=").append(bufferSizeInt).append(", connectionSource=")
.append(connectionSource.toString()).append(", tableName=").append(tableName).append(", columns=[ ");
int i = 0;
for (final ColumnConfig column : columnConfigs) {
if (i++ > 0) {
managerName.append(", ");
}
managerName.append(column.toString());
}
managerName.append(" ] }");
final JDBCDatabaseManager manager = JDBCDatabaseManager.getJDBCDatabaseManager(
managerName.toString(), bufferSizeInt, connectionSource, tableName, columnConfigs
);
if (manager == null) {
return null;
}
return new JDBCAppender(name, filter, ignoreExceptions, manager);
}
示例5: createAppender
import org.apache.logging.log4j.core.appender.AbstractAppender; //导入方法依赖的package包/类
/**
* Factory method for creating a NoSQL appender within the plugin manager.
*
* @param name
* The name of the appender.
* @param ignore
* If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they
* are propagated to the caller.
* @param filter
* The filter, if any, to use.
* @param bufferSize
* If an integer greater than 0, this causes the appender to buffer log events and flush whenever the
* buffer reaches this size.
* @param provider
* The NoSQL provider that provides connections to the chosen NoSQL database.
* @return a new NoSQL appender.
* @deprecated since 2.10.1; use {@link Builder}.
*/
@SuppressWarnings("resource")
@Deprecated
public static NoSqlAppender createAppender(
// @formatter:off
final String name,
final String ignore,
final Filter filter,
final String bufferSize,
final NoSqlProvider<?> provider) {
// @formatter:on
if (provider == null) {
LOGGER.error("NoSQL provider not specified for appender [{}].", name);
return null;
}
final int bufferSizeInt = AbstractAppender.parseInt(bufferSize, 0);
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
final String managerName = "noSqlManager{ description=" + name + ", bufferSize=" + bufferSizeInt + ", provider="
+ provider + " }";
final NoSqlDatabaseManager<?> manager = NoSqlDatabaseManager.getNoSqlDatabaseManager(managerName, bufferSizeInt,
provider);
if (manager == null) {
return null;
}
return new NoSqlAppender(name, filter, null, ignoreExceptions, manager);
}