Java Code Examples for org.apache.logging.log4j.util.PropertiesUtil#getBooleanProperty()

The following examples show how to use org.apache.logging.log4j.util.PropertiesUtil#getBooleanProperty() . 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: ThreadContext.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
/**
 * <em>Consider private, used for testing.</em>
 */
static void init() {
    ThreadContextMapFactory.init();
    contextMap = null;
    final PropertiesUtil managerProps = PropertiesUtil.getProperties();
    boolean disableAll = managerProps.getBooleanProperty(DISABLE_ALL);
    useStack = !(managerProps.getBooleanProperty(DISABLE_STACK) || disableAll);
    boolean 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;
    }
}
 
Example 2
Source File: GarbageFreeSortedArrayThreadContextMap.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: CopyOnWriteSortedArrayThreadContextMap.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: ThreadContextMapFactory.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: PatternLayout.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
private boolean useAnsiEscapeCodes() {
    PropertiesUtil propertiesUtil = PropertiesUtil.getProperties();
    boolean isPlatformSupportsAnsi = !propertiesUtil.isOsWindows();
    boolean isJansiRequested = !propertiesUtil.getBooleanProperty("log4j.skipJansi", true);
    return isPlatformSupportsAnsi || isJansiRequested;
}