本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}