• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Integers类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.logging.log4j.core.helpers.Integers的典型用法代码示例。如果您正苦于以下问题:Java Integers类的具体用法?Java Integers怎么用?Java Integers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Integers类属于org.apache.logging.log4j.core.helpers包,在下文中一共展示了Integers类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createAgent

import org.apache.logging.log4j.core.helpers.Integers; //导入依赖的package包/类
/**
 * Create an Agent.
 * @param host The host name.
 * @param port The port number.
 * @return The Agent.
 */
@PluginFactory
public static Agent createAgent(@PluginAttribute("host") String host,
        @PluginAttribute("port") final String port) {
    if (host == null) {
        host = DEFAULT_HOST;
    }

    int portNum;
    try {
        portNum = Integers.parseInt(port, DEFAULT_PORT);
    } catch (final Exception ex) {
        LOGGER.error("Error parsing port number " + port, ex);
        return null;
    }
    return new Agent(host, portNum);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:23,代码来源:Agent.java


示例2: parseInt

import org.apache.logging.log4j.core.helpers.Integers; //导入依赖的package包/类
public static int parseInt(String s, int defaultValue) {
    try {
        return Integers.parseInt(s, defaultValue);
    } catch (NumberFormatException e) {
        LOGGER.error("Could not parse \"{}\" as an integer,  using default value {}: {}", s, defaultValue, e);
        return defaultValue;
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:9,代码来源:AbstractAppender.java


示例3: createPolicy

import org.apache.logging.log4j.core.helpers.Integers; //导入依赖的package包/类
/**
 * Create a TimeBasedTriggeringPolicy.
 * @param interval The interval between rollovers.
 * @param modulate If true the time will be rounded to occur on a boundary aligned with the increment.
 * @return a TimeBasedTriggeringPolicy.
 */
@PluginFactory
public static TimeBasedTriggeringPolicy createPolicy(
        @PluginAttribute("interval") final String interval,
        @PluginAttribute("modulate") final String modulate) {
    final int increment = Integers.parseInt(interval, 1);
    final boolean mod = Boolean.parseBoolean(modulate);
    return new TimeBasedTriggeringPolicy(increment, mod);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:15,代码来源:TimeBasedTriggeringPolicy.java


示例4: createStrategy

import org.apache.logging.log4j.core.helpers.Integers; //导入依赖的package包/类
/**
 * Create the DefaultRolloverStrategy.
 * @param max The maximum number of files to keep.
 * @param min The minimum number of files to keep.
 * @param fileIndex If set to "max" (the default), files with a higher index will be newer than files with a
 * smaller index. If set to "min", file renaming and the counter will follow the Fixed Window strategy.
 * @param compressionLevelStr The compression level, 0 (less) through 9 (more); applies only to ZIP files.
 * @param config The Configuration.
 * @return A DefaultRolloverStrategy.
 */
@PluginFactory
public static DefaultRolloverStrategy createStrategy(
        @PluginAttribute("max") final String max,
        @PluginAttribute("min") final String min,
        @PluginAttribute("fileIndex") final String fileIndex,
        @PluginAttribute("compressionLevel") final String compressionLevelStr,
        @PluginConfiguration final Configuration config) {
    final boolean useMax = fileIndex == null ? true : fileIndex.equalsIgnoreCase("max");
    int minIndex;
    if (min != null) {
        minIndex = Integer.parseInt(min);
        if (minIndex < 1) {
            LOGGER.error("Minimum window size too small. Limited to " + MIN_WINDOW_SIZE);
            minIndex = MIN_WINDOW_SIZE;
        }
    } else {
        minIndex = MIN_WINDOW_SIZE;
    }
    int maxIndex;
    if (max != null) {
        maxIndex = Integer.parseInt(max);
        if (maxIndex < minIndex) {
            maxIndex = minIndex < DEFAULT_WINDOW_SIZE ? DEFAULT_WINDOW_SIZE : minIndex;
            LOGGER.error("Maximum window size must be greater than the minimum windows size. Set to " + maxIndex);
        }
    } else {
        maxIndex = DEFAULT_WINDOW_SIZE;
    }
    final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION);
    return new DefaultRolloverStrategy(minIndex, maxIndex, useMax, compressionLevel, config.getStrSubstitutor());
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:42,代码来源:DefaultRolloverStrategy.java


示例5: createLayout

import org.apache.logging.log4j.core.helpers.Integers; //导入依赖的package包/类
/**
 * Create the RFC 5424 Layout.
 *
 * @param facility         The Facility is used to try to classify the message.
 * @param id               The default structured data id to use when formatting according to RFC 5424.
 * @param ein              The IANA enterprise number.
 * @param includeMDC       Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog
 *                         record. Defaults to "true:.
 * @param mdcId            The id to use for the MDC Structured Data Element.
 * @param mdcPrefix        The prefix to add to MDC key names.
 * @param eventPrefix      The prefix to add to event key names.
 * @param includeNL        If true, a newline will be appended to the end of the syslog record. The default is false.
 * @param escapeNL         String that should be used to replace newlines within the message text.
 * @param appName          The value to use as the APP-NAME in the RFC 5424 syslog record.
 * @param msgId            The default value to be used in the MSGID field of RFC 5424 syslog records.
 * @param excludes         A comma separated list of MDC keys that should be excluded from the LogEvent.
 * @param includes         A comma separated list of MDC keys that should be included in the FlumeEvent.
 * @param required         A comma separated list of MDC keys that must be present in the MDC.
 * @param exceptionPattern The pattern for formatting exceptions.
 * @param useTLSMessageFormat If true the message will be formatted according to RFC 5425.
 * @param loggerFields     Container for the KeyValuePairs containing the patterns
 * @param config           The Configuration. Some Converters require access to the Interpolator.
 * @return An RFC5424Layout.
 */
@PluginFactory
public static RFC5424Layout createLayout(
        @PluginAttribute("facility") final String facility,
        @PluginAttribute("id") final String id,
        @PluginAttribute("enterpriseNumber") final String ein,
        @PluginAttribute("includeMDC") final String includeMDC,
        @PluginAttribute("mdcId") String mdcId,
        @PluginAttribute("mdcPrefix") final String mdcPrefix,
        @PluginAttribute("eventPrefix") final String eventPrefix,
        @PluginAttribute("newLine") final String includeNL,
        @PluginAttribute("newLineEscape") final String escapeNL,
        @PluginAttribute("appName") final String appName,
        @PluginAttribute("messageId") final String msgId,
        @PluginAttribute("mdcExcludes") final String excludes,
        @PluginAttribute("mdcIncludes") String includes,
        @PluginAttribute("mdcRequired") final String required,
        @PluginAttribute("exceptionPattern") final String exceptionPattern,
        @PluginAttribute("useTLSMessageFormat") final String useTLSMessageFormat, // RFC 5425
        @PluginElement("LoggerFields") final LoggerFields[] loggerFields,
        @PluginConfiguration final Configuration config) {
    final Charset charset = Charsets.UTF_8;
    if (includes != null && excludes != null) {
        LOGGER.error("mdcIncludes and mdcExcludes are mutually exclusive. Includes wil be ignored");
        includes = null;
    }
    final Facility f = Facility.toFacility(facility, Facility.LOCAL0);
    final int enterpriseNumber = Integers.parseInt(ein, DEFAULT_ENTERPRISE_NUMBER);
    final boolean isMdc = Booleans.parseBoolean(includeMDC, true);
    final boolean includeNewLine = Boolean.parseBoolean(includeNL);
    final boolean useTlsMessageFormat = Booleans.parseBoolean(useTLSMessageFormat, false);
    if (mdcId == null) {
        mdcId = DEFAULT_MDCID;
    }

    return new RFC5424Layout(config, f, id, enterpriseNumber, isMdc, includeNewLine, escapeNL, mdcId, mdcPrefix,
            eventPrefix, appName, msgId, excludes, includes, required, charset, exceptionPattern,
            useTlsMessageFormat, loggerFields);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:63,代码来源:RFC5424Layout.java



注:本文中的org.apache.logging.log4j.core.helpers.Integers类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Event类代码示例发布时间:2022-05-23
下一篇:
Java TokenTypes类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap