本文整理汇总了Java中ch.qos.logback.core.util.Loader.getResourceOccurrenceCount方法的典型用法代码示例。如果您正苦于以下问题:Java Loader.getResourceOccurrenceCount方法的具体用法?Java Loader.getResourceOccurrenceCount怎么用?Java Loader.getResourceOccurrenceCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.util.Loader
的用法示例。
在下文中一共展示了Loader.getResourceOccurrenceCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: multiplicityWarning
import ch.qos.logback.core.util.Loader; //导入方法依赖的package包/类
private void multiplicityWarning(String resourceName, ClassLoader classLoader) {
Set urlSet = null;
StatusManager sm = this.loggerContext.getStatusManager();
try {
urlSet = Loader.getResourceOccurrenceCount(resourceName, classLoader);
} catch (IOException var7) {
sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", this.loggerContext, var7));
}
if (urlSet != null && urlSet.size() > 1) {
sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.", this.loggerContext));
Iterator i$ = urlSet.iterator();
while (i$.hasNext()) {
URL url = (URL) i$.next();
sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]", this.loggerContext));
}
}
}
示例2: multiplicityWarning
import ch.qos.logback.core.util.Loader; //导入方法依赖的package包/类
private void multiplicityWarning(String resourceName, ClassLoader classLoader) {
Set<URL> urlSet = null;
StatusManager sm = loggerContext.getStatusManager();
try {
urlSet = Loader.getResourceOccurrenceCount(resourceName, classLoader);
} catch (IOException e) {
sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]",
loggerContext, e));
}
if (urlSet != null && urlSet.size() > 1) {
sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.",
loggerContext));
for (URL url : urlSet) {
sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]",
loggerContext));
}
}
}