本文整理汇总了Java中ch.qos.logback.core.util.Loader类的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loader类属于ch.qos.logback.core.util包,在下文中一共展示了Loader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
}
}
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:22,代码来源:KonkerContextInitializer.java
示例2: writeLogsOnFileAndConsole
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private void writeLogsOnFileAndConsole() {
loggers.debug("****Configuring Logger****");
try {
if(Platform.isRunning()){
System.setProperty(HYDROGRAPH_INSTALLATION_LOCATION, Platform.getInstallLocation().getURL().getPath());
ClassLoader loader = new URLClassLoader(new URL[]
{new File(Platform.getInstallLocation().getURL().getPath() + LOG_DIR).toURI().toURL()});
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
URL url = Loader.getResource(CLASSIC_FILE, loader);
if (url != null) {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
configurator.doConfigure(url);
lc.start();
}
loggers.debug("****Logger Configured Successfully****");
}
} catch(MalformedURLException|JoranException exception){
loggers.error("Failed to configure the logger {}", exception);
}
}
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:LogFactory.java
示例3: findURLOfDefaultConfigurationFile
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
public URL findURLOfDefaultConfigurationFile(boolean updateStatus) {
ClassLoader myClassLoader = Loader.getClassLoaderOfObject(this);
URL url = findConfigFileURLFromSystemProperties(myClassLoader, updateStatus);
if (url != null) {
return url;
}
url = getResource(GROOVY_AUTOCONFIG_FILE, myClassLoader, updateStatus);
if (url != null) {
return url;
}
url = getResource(TEST_AUTOCONFIG_FILE, myClassLoader, updateStatus);
if (url != null) {
return url;
}
return getResource(AUTOCONFIG_FILE, myClassLoader, updateStatus);
}
开发者ID:cscfa,项目名称:bartleby,代码行数:20,代码来源:ContextInitializer.java
示例4: 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));
}
}
}
开发者ID:cscfa,项目名称:bartleby,代码行数:19,代码来源:ContextInitializer.java
示例5: findURLOfDefaultConfigurationFile
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private String findURLOfDefaultConfigurationFile() {
ClassLoader myClassLoader = Loader.getClassLoaderOfObject(this);
URL url = getResource(TEST_AUTOCONFIG_FILE, myClassLoader);
if (url != null) {
return TEST_AUTOCONFIG_FILE;
}
url = getResource(AUTOCONFIG_FILE, myClassLoader);
if (url != null) {
return AUTOCONFIG_FILE;
}
return DEFAULT_CONFIG_FILE;
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:17,代码来源:StaticLoggerBinder.java
示例6: getPropertyValue
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
public String getPropertyValue() {
if (path == null) {
return "false";
}
URL resourceURL = Loader.getResourceBySelfClassLoader(path);
return (resourceURL != null) ? "true" : "false";
}
开发者ID:zhaojunfei,项目名称:lemon,代码行数:10,代码来源:ResourceExistsPropertyDefiner.java
示例7: findConfigFileURLFromSystemProperties
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private URL findConfigFileURLFromSystemProperties(ClassLoader classLoader, boolean updateStatus) {
String logbackConfigFile = OptionHelper.getSystemProperty("logback.configurationFile");
if (logbackConfigFile != null) {
URL result = null;
URL f;
try {
result = new URL(logbackConfigFile);
URL e = result;
return e;
} catch (MalformedURLException var13) {
result = Loader.getResource(logbackConfigFile, classLoader);
if (result == null) {
File f1 = new File(logbackConfigFile);
if (!f1.exists() || !f1.isFile()) {
return null;
}
try {
result = f1.toURI().toURL();
URL e1 = result;
return e1;
} catch (MalformedURLException var12) {
return null;
}
}
f = result;
} finally {
if (updateStatus) {
this.statusOnResourceSearch(logbackConfigFile, classLoader, result);
}
}
return f;
} else {
return null;
}
}
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:41,代码来源:KonkerContextInitializer.java
示例8: findURLOfDefaultConfigurationFile
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
public URL findURLOfDefaultConfigurationFile(boolean updateStatus) {
ClassLoader myClassLoader = Loader.getClassLoaderOfObject(this);
URL url = this.findConfigFileURLFromSystemProperties(myClassLoader, updateStatus);
if (url != null) {
return url;
} else {
url = this.getResource("logback.groovy", myClassLoader, updateStatus);
if (url != null) {
return url;
} else {
url = this.getResource("logback-test.xml", myClassLoader, updateStatus);
return url != null ? url : this.getResource("logback.xml", myClassLoader, updateStatus);
}
}
}
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:16,代码来源:KonkerContextInitializer.java
示例9: getResource
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private URL getResource(String filename, ClassLoader myClassLoader, boolean updateStatus) {
URL url = Loader.getResource(filename, myClassLoader);
if (updateStatus) {
this.statusOnResourceSearch(filename, myClassLoader, url);
}
return url;
}
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:9,代码来源:KonkerContextInitializer.java
示例10: getPropertyValue
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
/**
* Returns the string "true" if the {@link #setResource(String) resource} specified by the
* user is available on the class path, "false" otherwise.
*
* @return "true"|"false" depending on the availability of resource on the classpath
*/
public String getPropertyValue() {
if (OptionHelper.isEmpty(resourceStr)) {
addError("The \"resource\" property must be set.");
return null;
}
URL resourceURL = Loader.getResourceBySelfClassLoader(resourceStr);
return booleanAsStr(resourceURL != null);
}
开发者ID:cscfa,项目名称:bartleby,代码行数:16,代码来源:ResourceExistsPropertyDefiner.java
示例11: resourceAsURL
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
URL resourceAsURL(String resourceAttribute) {
URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
if (url == null) {
optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]");
return null;
} else
return url;
}
开发者ID:cscfa,项目名称:bartleby,代码行数:9,代码来源:IncludeAction.java
示例12: urlByResourceName
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]",
this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:ContextJNDISelector.java
示例13: findConfigFileURLFromSystemProperties
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private URL findConfigFileURLFromSystemProperties(ClassLoader classLoader, boolean updateStatus) {
String logbackConfigFile = OptionHelper.getSystemProperty(CONFIG_FILE_PROPERTY);
if (logbackConfigFile != null) {
URL result = null;
try {
result = new URL(logbackConfigFile);
return result;
} catch (MalformedURLException e) {
// so, resource is not a URL:
// attempt to get the resource from the class path
result = Loader.getResource(logbackConfigFile, classLoader);
if (result != null) {
return result;
}
File f = new File(logbackConfigFile);
if (f.exists() && f.isFile()) {
try {
result = f.toURI().toURL();
return result;
} catch (MalformedURLException e1) {
}
}
} finally {
if (updateStatus) {
statusOnResourceSearch(logbackConfigFile, classLoader, result);
}
}
}
return null;
}
开发者ID:cscfa,项目名称:bartleby,代码行数:31,代码来源:ContextInitializer.java
示例14: getResource
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
private URL getResource(String filename, ClassLoader myClassLoader, boolean updateStatus) {
URL url = Loader.getResource(filename, myClassLoader);
if (updateStatus) {
statusOnResourceSearch(filename, myClassLoader, url);
}
return url;
}
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:ContextInitializer.java
示例15: isGroovyAvailable
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
static public boolean isGroovyAvailable() {
ClassLoader classLoader = Loader.getClassLoaderOfClass(EnvUtil.class);
try {
Class<?> bindingClass = classLoader.loadClass("groovy.lang.Binding");
return (bindingClass != null);
} catch (ClassNotFoundException e) {
return false;
}
}
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:EnvUtil.java
示例16: shouldConfigureFromXmlFile
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
@Test
public void shouldConfigureFromXmlFile() throws MalformedURLException, JoranException {
LoggerContext loggerContext = new LoggerContext();
ContextInitializer initializer = new ContextInitializer(loggerContext);
assertNull(loggerContext.getObject(CoreConstants.SAFE_JORAN_CONFIGURATION));
URL configurationFileUrl = Loader.getResource("BOO_logback-test.xml", Thread.currentThread().getContextClassLoader());
initializer.configureByResource(configurationFileUrl);
assertNotNull(loggerContext.getObject(CoreConstants.SAFE_JORAN_CONFIGURATION));
}
开发者ID:cscfa,项目名称:bartleby,代码行数:12,代码来源:ContextInitializerTest.java
示例17: shouldConfigureFromGroovyScript
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
@Test
public void shouldConfigureFromGroovyScript() throws MalformedURLException, JoranException {
LoggerContext loggerContext = new LoggerContext();
ContextInitializer initializer = new ContextInitializer(loggerContext);
assertNull(loggerContext.getObject(CoreConstants.CONFIGURATION_WATCH_LIST));
URL configurationFileUrl = Loader.getResource("test.groovy", Thread.currentThread().getContextClassLoader());
initializer.configureByResource(configurationFileUrl);
assertNotNull(loggerContext.getObject(CoreConstants.CONFIGURATION_WATCH_LIST));
}
开发者ID:cscfa,项目名称:bartleby,代码行数:12,代码来源:ContextInitializerTest.java
示例18: shouldThrowExceptionIfUnexpectedConfigurationFileExtension
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
@Test
public void shouldThrowExceptionIfUnexpectedConfigurationFileExtension() throws JoranException {
LoggerContext loggerContext = new LoggerContext();
ContextInitializer initializer = new ContextInitializer(loggerContext);
URL configurationFileUrl = Loader.getResource("README.txt", Thread.currentThread().getContextClassLoader());
try {
initializer.configureByResource(configurationFileUrl);
fail("Should throw LogbackException");
} catch (LogbackException expectedException) {
// pass
}
}
开发者ID:cscfa,项目名称:bartleby,代码行数:14,代码来源:ContextInitializerTest.java
示例19: configureViaXML_File
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
static void configureViaXML_File() {
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
URL url = Loader.getResourceBySelfClassLoader("chapters/mdc/simpleMDC.xml");
configurator.doConfigure(url);
} catch (JoranException je) {
StatusPrinter.print(lc);
}
}
开发者ID:cscfa,项目名称:bartleby,代码行数:13,代码来源:SimpleMDC.java
示例20: dynamicalContextSelector
import ch.qos.logback.core.util.Loader; //导入依赖的package包/类
static KonkerDefaultContextSelector dynamicalContextSelector(KonkerLoggerContext defaultLoggerContext, String contextSelectorStr) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
Class contextSelectorClass = Loader.loadClass(contextSelectorStr);
Constructor cons = contextSelectorClass.getConstructor(new Class[]{LoggerContext.class});
return (KonkerDefaultContextSelector) cons.newInstance(new Object[]{defaultLoggerContext});
}
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:6,代码来源:KonkerSelectorStaticBinder.java
注:本文中的ch.qos.logback.core.util.Loader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论