本文整理汇总了Java中ch.qos.logback.core.util.Loader.getResourceBySelfClassLoader方法的典型用法代码示例。如果您正苦于以下问题:Java Loader.getResourceBySelfClassLoader方法的具体用法?Java Loader.getResourceBySelfClassLoader怎么用?Java Loader.getResourceBySelfClassLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.util.Loader
的用法示例。
在下文中一共展示了Loader.getResourceBySelfClassLoader方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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";
}
示例2: 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);
}
示例3: 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;
}
示例4: 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);
}
示例5: 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);
}
}