本文整理汇总了Java中org.slf4j.helpers.Util类的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Util类属于org.slf4j.helpers包,在下文中一共展示了Util类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookUpConfiguredLoggerFactory
import org.slf4j.helpers.Util; //导入依赖的package包/类
private Set<Class<? extends ILoggerFactory>> lookUpConfiguredLoggerFactory() {
final Set<Class<? extends ILoggerFactory>> loggerFactories = new HashSet<>();
final String configuredLoggerFactory = System.getProperty(ENVIRONMENT_VAR_LOGGER_FACTORY);
if (StringUtils.isNotBlank(configuredLoggerFactory)) {
Util.report("Instructed logger factory to use is " + configuredLoggerFactory);
try {
final Class clazz = Class.forName(configuredLoggerFactory);
loggerFactories.add(clazz);
} catch (final Exception e) {
Util.report("Could not locate the provided logger factory: " + configuredLoggerFactory + ". Error: " + e.getMessage());
}
}
return loggerFactories;
}
示例2: computeTargetStream
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static PrintStream computeTargetStream(String logFile) {
if ("System.err".equalsIgnoreCase(logFile))
return System.err; // NOSONAR
else if ("System.out".equalsIgnoreCase(logFile)) {
return System.out; // NOSONAR
} else {
try {
FileOutputStream fos = new FileOutputStream(logFile);
PrintStream printStream = new PrintStream(fos);
return printStream;
} catch (FileNotFoundException e) {
Util.report("Could not open [" + logFile + "]. Defaulting to System.err", e);
return System.err; // NOSONAR
}
}
}
示例3: init
import org.slf4j.helpers.Util; //导入依赖的package包/类
void init() {
try {
try {
(new KonkerContextInitializer(this.defaultLoggerContext)).autoConfig();
} catch (JoranException var2) {
Util.report("Failed to auto configure default logger context", var2);
}
if(!StatusUtil.contextHasStatusListener(this.defaultLoggerContext)) {
StatusPrinter.printInCaseOfErrorsOrWarnings(this.defaultLoggerContext);
}
this.contextSelectorBinder.init(this.defaultLoggerContext, KEY);
this.initialized = true;
} catch (Throwable var3) {
Util.report("Failed to instantiate [" + LoggerContext.class.getName() + "]", var3);
}
}
示例4: fixSubstitutedLoggers
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static final void fixSubstitutedLoggers() {
List loggers = TEMP_FACTORY.getLoggers();
if(!loggers.isEmpty()) {
Util.report("The following set of substitute loggers may have been accessed");
Util.report("during the initialization phase. Logging calls during this");
Util.report("phase were not honored. However, subsequent logging calls to these");
Util.report("loggers will work as normally expected.");
Util.report("See also http://www.slf4j.org/codes.html#substituteLogger");
Iterator i$ = loggers.iterator();
while(i$.hasNext()) {
SubstituteLogger subLogger = (SubstituteLogger)i$.next();
subLogger.setDelegate(getKonkerLogger(subLogger.getName()));
Util.report(subLogger.getName());
}
TEMP_FACTORY.clear();
}
}
示例5: versionSanityCheck
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static final void versionSanityCheck() {
try {
String e = StaticLoggerBinder.REQUESTED_API_VERSION;
boolean match = false;
String[] arr$ = API_COMPATIBILITY_LIST;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
String aAPI_COMPATIBILITY_LIST = arr$[i$];
if(e.startsWith(aAPI_COMPATIBILITY_LIST)) {
match = true;
}
}
if(!match) {
Util.report("The requested version " + e + " by your slf4j binding is not compatible with " + Arrays.asList(API_COMPATIBILITY_LIST).toString());
Util.report("See http://www.slf4j.org/codes.html#version_mismatch for further details.");
}
} catch (NoSuchFieldError var6) {
;
} catch (Throwable var7) {
Util.report("Unexpected problem occured during version sanity check", var7);
}
}
示例6: findPossibleStaticLoggerBinderPathSet
import org.slf4j.helpers.Util; //导入依赖的package包/类
static Set<URL> findPossibleStaticLoggerBinderPathSet() {
LinkedHashSet staticLoggerBinderPathSet = new LinkedHashSet();
try {
ClassLoader ioe = LoggerFactory.class.getClassLoader();
Enumeration paths;
if(ioe == null) {
paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
} else {
paths = ioe.getResources(STATIC_LOGGER_BINDER_PATH);
}
while(paths.hasMoreElements()) {
URL path = (URL)paths.nextElement();
staticLoggerBinderPathSet.add(path);
}
} catch (IOException var4) {
Util.report("Error getting resources from path", var4);
}
return staticLoggerBinderPathSet;
}
示例7: reportMultipleBindingAmbiguity
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static void reportMultipleBindingAmbiguity(Set<URL> staticLoggerBinderPathSet) {
if(!isAndroid()) {
if(isAmbiguousStaticLoggerBinderPathSet(staticLoggerBinderPathSet)) {
Util.report("Class path contains multiple SLF4J bindings.");
Iterator i$ = staticLoggerBinderPathSet.iterator();
while(i$.hasNext()) {
URL path = (URL)i$.next();
Util.report("Found binding in [" + path + "]");
}
Util.report("See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.");
}
}
}
示例8: init
import org.slf4j.helpers.Util; //导入依赖的package包/类
static void init() {
INITIALIZED = true;
loadProperties();
String defaultLogLevelString = getStringProperty( DEFAULT_LOG_LEVEL_KEY, null );
if ( defaultLogLevelString != null )
DEFAULT_LOG_LEVEL = stringToLevel( defaultLogLevelString );
SHOW_LOG_NAME = getBooleanProperty( SHOW_LOG_NAME_KEY, SHOW_LOG_NAME );
SHOW_SHORT_LOG_NAME = getBooleanProperty( SHOW_SHORT_LOG_NAME_KEY, SHOW_SHORT_LOG_NAME );
SHOW_DATE_TIME = getBooleanProperty( SHOW_DATE_TIME_KEY, SHOW_DATE_TIME );
SHOW_THREAD_NAME = getBooleanProperty( SHOW_THREAD_NAME_KEY, SHOW_THREAD_NAME );
DATE_TIME_FORMAT_STR = getStringProperty( DATE_TIME_FORMAT_KEY, DATE_TIME_FORMAT_STR );
LEVEL_IN_BRACKETS = getBooleanProperty( LEVEL_IN_BRACKETS_KEY, LEVEL_IN_BRACKETS );
WARN_LEVEL_STRING = getStringProperty( WARN_LEVEL_STRING_KEY, WARN_LEVEL_STRING );
if ( DATE_TIME_FORMAT_STR != null ) {
try {
DATE_FORMATTER = new SimpleDateFormat( DATE_TIME_FORMAT_STR );
} catch ( IllegalArgumentException e ) {
Util.report( "Bad date format in " + CONFIGURATION_FILE + "; will output relative time", e );
}
}
}
示例9: computeTargetStream
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static PrintStream computeTargetStream( String logFile ) {
if ( "System.err".equalsIgnoreCase( logFile ) )
return System.err;
else if ( "System.out".equalsIgnoreCase( logFile ) ) {
return System.out;
} else {
try {
FileOutputStream fos = new FileOutputStream( logFile );
PrintStream printStream = new PrintStream( fos );
return printStream;
} catch ( FileNotFoundException e ) {
Util.report( "Could not open [" + logFile + "]. Defaulting to System.err", e );
return System.err;
}
}
}
示例10: fixSubstitutedLoggers
import org.slf4j.helpers.Util; //导入依赖的package包/类
private final static void fixSubstitutedLoggers() {
List<SubstituteLogger> loggers = TEMP_FACTORY.getLoggers();
if (loggers.isEmpty()) {
return;
}
Util.report("The following set of substitute loggers may have been accessed");
Util.report("during the initialization phase. Logging calls during this");
Util.report("phase were not honored. However, subsequent logging calls to these");
Util.report("loggers will work as normally expected.");
Util.report("See also " + SUBSTITUTE_LOGGER_URL);
for (SubstituteLogger subLogger : loggers) {
subLogger.setDelegate(getLogger(subLogger.getName()));
Util.report(subLogger.getName());
}
TEMP_FACTORY.clear();
}
示例11: versionSanityCheck
import org.slf4j.helpers.Util; //导入依赖的package包/类
private final static void versionSanityCheck() {
try {
String requested = StaticLoggerBinder.REQUESTED_API_VERSION;
boolean match = false;
for (int i = 0; i < API_COMPATIBILITY_LIST.length; i++) {
if (requested.startsWith(API_COMPATIBILITY_LIST[i])) {
match = true;
}
}
if (!match) {
Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
+ Arrays.asList(API_COMPATIBILITY_LIST).toString());
Util.report("See " + VERSION_MISMATCH + " for further details.");
}
} catch (java.lang.NoSuchFieldError nsfe) {
// given our large user base and SLF4J's commitment to backward
// compatibility, we cannot cry here. Only for implementations
// which willingly declare a REQUESTED_API_VERSION field do we
// emit compatibility warnings.
} catch (Throwable e) {
// we should never reach here
Util.report("Unexpected problem occured during version sanity check", e);
}
}
示例12: findPossibleStaticLoggerBinderPathSet
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static Set<URL> findPossibleStaticLoggerBinderPathSet() {
// use Set instead of list in order to deal with bug #138
// LinkedHashSet appropriate here because it preserves insertion order during iteration
Set<URL> staticLoggerBinderPathSet = new LinkedHashSet<URL>();
try {
ClassLoader loggerFactoryClassLoader = LoggerFactory.class.getClassLoader();
Enumeration<URL> paths;
if (loggerFactoryClassLoader == null) {
paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
} else {
paths = loggerFactoryClassLoader.getResources(STATIC_LOGGER_BINDER_PATH);
}
while (paths.hasMoreElements()) {
URL path = (URL) paths.nextElement();
staticLoggerBinderPathSet.add(path);
}
} catch (IOException ioe) {
Util.report("Error getting resources from path", ioe);
}
return staticLoggerBinderPathSet;
}
示例13: computeTargetStream
import org.slf4j.helpers.Util; //导入依赖的package包/类
private static PrintStream computeTargetStream(String logFile) {
if ("System.err".equalsIgnoreCase(logFile))
return System.err;
else if ("System.out".equalsIgnoreCase(logFile)) {
return System.out;
} else {
try {
FileOutputStream fos = new FileOutputStream(logFile);
PrintStream printStream = new PrintStream(fos);
return printStream;
} catch (FileNotFoundException e) {
Util.report("Could not open [" + logFile + "]. Defaulting to System.err", e);
return System.err;
}
}
}
示例14: init
import org.slf4j.helpers.Util; //导入依赖的package包/类
/**
* Package access for testing purposes.
*/
void init() {
try {
try {
new ContextInitializer(defaultLoggerContext).autoConfig();
} catch (JoranException je) {
Util.report("Failed to auto configure default logger context", je);
}
// logback-292
if(!StatusUtil.contextHasStatusListener(defaultLoggerContext)) {
StatusPrinter.printInCaseOfErrorsOrWarnings(defaultLoggerContext);
}
contextSelectorBinder.init(defaultLoggerContext, KEY);
initialized = true;
} catch (Throwable t) {
// we should never get here
Util.report("Failed to instantiate [" + LoggerContext.class.getName()
+ "]", t);
}
}
示例15: versionSanityCheck
import org.slf4j.helpers.Util; //导入依赖的package包/类
private final static void versionSanityCheck() {
try {
String requested = requestedApiVersion();
boolean match = false;
for (String element : API_COMPATIBILITY_LIST) {
if (requested.startsWith(element)) {
match = true;
}
}
if (!match) {
Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
+ Arrays.asList(API_COMPATIBILITY_LIST).toString());
Util.report("See " + VERSION_MISMATCH + " for further details.");
}
} catch (java.lang.NoSuchFieldError nsfe) {
// given our large user base and SLF4J's commitment to backward
// compatibility, we cannot cry here. Only for implementations
// which willingly declare a REQUESTED_API_VERSION field do we
// emit compatibility warnings.
} catch (Throwable e) {
// we should never reach here
Util.report("Unexpected problem occured during version sanity check", e);
}
}