当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesUtil.getBooleanProperty方法代码示例

本文整理汇总了Java中org.apache.logging.log4j.util.PropertiesUtil.getBooleanProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesUtil.getBooleanProperty方法的具体用法?Java PropertiesUtil.getBooleanProperty怎么用?Java PropertiesUtil.getBooleanProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.logging.log4j.util.PropertiesUtil的用法示例。


在下文中一共展示了PropertiesUtil.getBooleanProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.logging.log4j.util.PropertiesUtil; //导入方法依赖的package包/类
/**
 * <em>Consider private, used for testing.</em>
 */
static void init() {
    ThreadContextMapFactory.init();
    contextMap = null;
    final PropertiesUtil managerProps = PropertiesUtil.getProperties();
    disableAll = managerProps.getBooleanProperty(DISABLE_ALL);
    useStack = !(managerProps.getBooleanProperty(DISABLE_STACK) || disableAll);
    useMap = !(managerProps.getBooleanProperty(DISABLE_MAP) || disableAll);

    contextStack = new DefaultThreadContextStack(useStack);
    if (!useMap) {
        contextMap = new NoOpThreadContextMap();
    } else {
        contextMap = ThreadContextMapFactory.createThreadContextMap();
    }
    if (contextMap instanceof ReadOnlyThreadContextMap) {
        readOnlyContextMap = (ReadOnlyThreadContextMap) contextMap;
    } else {
        readOnlyContextMap = null;
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:24,代码来源:ThreadContext.java

示例2: SimpleLoggerContext

import org.apache.logging.log4j.util.PropertiesUtil; //导入方法依赖的package包/类
public SimpleLoggerContext() {
    props = new PropertiesUtil("log4j2.simplelog.properties");

    showContextMap = props.getBooleanProperty(SYSTEM_PREFIX + "showContextMap", false);
    showLogName = props.getBooleanProperty(SYSTEM_PREFIX + "showlogname", false);
    showShortName = props.getBooleanProperty(SYSTEM_PREFIX + "showShortLogname", true);
    showDateTime = props.getBooleanProperty(SYSTEM_PREFIX + "showdatetime", false);
    final String lvl = props.getStringProperty(SYSTEM_PREFIX + "level");
    defaultLevel = Level.toLevel(lvl, Level.ERROR);

    dateTimeFormat = showDateTime ? props.getStringProperty(SimpleLoggerContext.SYSTEM_PREFIX + "dateTimeFormat",
            DEFAULT_DATE_TIME_FORMAT) : null;

    final String fileName = props.getStringProperty(SYSTEM_PREFIX + "logFile", "system.err");
    PrintStream ps;
    if ("system.err".equalsIgnoreCase(fileName)) {
        ps = System.err;
    } else if ("system.out".equalsIgnoreCase(fileName)) {
        ps = System.out;
    } else {
        try {
            final FileOutputStream os = new FileOutputStream(fileName);
            ps = new PrintStream(os);
        } catch (final FileNotFoundException fnfe) {
            ps = System.err;
        }
    }
    this.stream = ps;
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:30,代码来源:SimpleLoggerContext.java

示例3: SimpleLoggerContext

import org.apache.logging.log4j.util.PropertiesUtil; //导入方法依赖的package包/类
public SimpleLoggerContext() {
    props = new PropertiesUtil("log4j2.simplelog.properties");

    showContextMap = props.getBooleanProperty(SYSTEM_PREFIX + "showContextMap", false);
    showLogName = props.getBooleanProperty(SYSTEM_PREFIX + "showlogname", false);
    showShortName = props.getBooleanProperty(SYSTEM_PREFIX + "showShortLogname", true);
    showDateTime = props.getBooleanProperty(SYSTEM_PREFIX + "showdatetime", false);
    final String lvl = props.getStringProperty(SYSTEM_PREFIX + "level");
    defaultLevel = Level.toLevel(lvl, Level.ERROR);

    dateTimeFormat = showDateTime ? props.getStringProperty(SimpleLoggerContext.SYSTEM_PREFIX + "dateTimeFormat",
            DEFAULT_DATE_TIME_FORMAT) : null;

    final String fileName = props.getStringProperty(SYSTEM_PREFIX + "logFile", SYSTEM_ERR);
    PrintStream ps;
    if (SYSTEM_ERR.equalsIgnoreCase(fileName)) {
        ps = System.err;
    } else if (SYSTEM_OUT.equalsIgnoreCase(fileName)) {
        ps = System.out;
    } else {
        try {
            final FileOutputStream os = new FileOutputStream(fileName);
            ps = new PrintStream(os);
        } catch (final FileNotFoundException fnfe) {
            ps = System.err;
        }
    }
    this.stream = ps;
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:30,代码来源:SimpleLoggerContext.java

示例4: init

import org.apache.logging.log4j.util.PropertiesUtil; //导入方法依赖的package包/类
/**
 * Initializes static variables based on system properties. Normally called when this class is initialized by the VM
 * and when Log4j is reconfigured.
 */
static void init() {
    final PropertiesUtil properties = PropertiesUtil.getProperties();
    initialCapacity = properties.getIntegerProperty(PROPERTY_NAME_INITIAL_CAPACITY, DEFAULT_INITIAL_CAPACITY);
    inheritableMap = properties.getBooleanProperty(INHERITABLE_MAP);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:10,代码来源:GarbageFreeSortedArrayThreadContextMap.java

示例5: initPrivate

import org.apache.logging.log4j.util.PropertiesUtil; //导入方法依赖的package包/类
/**
 * Initializes static variables based on system properties. Normally called when this class is initialized by the VM
 * and when Log4j is reconfigured.
 */
private static void initPrivate() {
    final PropertiesUtil properties = PropertiesUtil.getProperties();
    ThreadContextMapName = properties.getStringProperty(THREAD_CONTEXT_KEY);
    GcFreeThreadContextKey = properties.getBooleanProperty(GC_FREE_THREAD_CONTEXT_KEY);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:10,代码来源:ThreadContextMapFactory.java

示例6: useAnsiEscapeCodes

import org.apache.logging.log4j.util.PropertiesUtil; //导入方法依赖的package包/类
private boolean useAnsiEscapeCodes() {
    PropertiesUtil propertiesUtil = PropertiesUtil.getProperties();
    boolean isPlatformSupportsAnsi = !propertiesUtil.isOsWindows();
    boolean isJansiRequested = !propertiesUtil.getBooleanProperty("log4j.skipJansi", true);
    return isPlatformSupportsAnsi || isJansiRequested;
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:7,代码来源:PatternLayout.java


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