本文整理了Java中freemarker.log.Logger.getLibraryName()
方法的一些代码示例,展示了Logger.getLibraryName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.getLibraryName()
方法的具体详情如下:
包路径:freemarker.log.Logger
类名称:Logger
方法名:getLibraryName
暂无
代码示例来源:origin: org.freemarker/freemarker
if (loggerFactoryWasAlreadySet) {
logWarnInLogger("Logger library was already set earlier to \""
+ getLibraryName(replacedLibraryEnum) + "\"; "
+ "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
+ "earlier.");
+ getLibraryName(libraryEnum)
+ "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
+ "\" system property is set to \"" + getLibraryName(Logger.libraryEnum) + "\".");
代码示例来源:origin: org.freemarker/freemarker
/**
* @throws ClassNotFoundException
* If the required logger library is not available.
*/
private static LoggerFactory createLoggerFactoryForNonAuto(int libraryEnum) throws ClassNotFoundException {
final String availabilityCheckClassName = getAvailabilityCheckClassName(libraryEnum);
if (availabilityCheckClassName != null) { // Dynamically created factory
Class.forName(availabilityCheckClassName);
String libraryName = getLibraryName(libraryEnum);
try {
return (LoggerFactory) Class.forName(
"freemarker.log._" + libraryName + "LoggerFactory").newInstance();
} catch (Exception e) {
throw new RuntimeException(
"Unexpected error when creating logger factory for \"" + libraryName + "\".", e);
}
} else { // Non-dynamically created factory
if (libraryEnum == LIBRARY_JAVA) {
return new _JULLoggerFactory();
} else if (libraryEnum == LIBRARY_NONE) {
return new _NullLoggerFactory();
} else {
throw new RuntimeException("Bug");
}
}
}
代码示例来源:origin: org.freemarker/freemarker
int matchedEnum = MIN_LIBRARY_ENUM;
do {
if (sysPropVal.equalsIgnoreCase(getLibraryName(matchedEnum))) {
foundMatch = true;
} else {
final boolean disableLogging = !(onlyIfCanBeSetFromSysProp && sysPropVal != null);
logErrorInLogger(
"Couldn't set up logger for \"" + getLibraryName(libraryEnum) + "\""
+ (disableLogging ? "; logging disabled" : "."), e);
if (disableLogging) {
代码示例来源:origin: org.freemarker/freemarker
/**
* @throws ClassNotFoundException
* If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
*/
private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
if (libraryEnum == LIBRARY_AUTO) {
for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
if (!isAutoDetected(libraryEnumToTry)) continue;
if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
libraryEnumToTry = LIBRARY_SLF4J;
}
try {
return createLoggerFactoryForNonAuto(libraryEnumToTry);
} catch (ClassNotFoundException e) {
// Expected, intentionally suppressed.
} catch (Throwable e) {
logErrorInLogger(
"Unexpected error when initializing logging for \""
+ getLibraryName(libraryEnumToTry) + "\".",
e);
}
}
logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
return new _NullLoggerFactory();
} else {
return createLoggerFactoryForNonAuto(libraryEnum);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
if (loggerFactoryWasAlreadySet) {
logWarnInLogger("Logger library was already set earlier to \""
+ getLibraryName(replacedLibraryEnum) + "\"; "
+ "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
+ "earlier.");
+ getLibraryName(libraryEnum)
+ "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
+ "\" system property is set to \"" + getLibraryName(Logger.libraryEnum) + "\".");
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* @throws ClassNotFoundException
* If the required logger library is not available.
*/
private static LoggerFactory createLoggerFactoryForNonAuto(int libraryEnum) throws ClassNotFoundException {
final String availabilityCheckClassName = getAvailabilityCheckClassName(libraryEnum);
if (availabilityCheckClassName != null) { // Dynamically created factory
Class.forName(availabilityCheckClassName);
String libraryName = getLibraryName(libraryEnum);
try {
return (LoggerFactory) Class.forName(
"freemarker.log._" + libraryName + "LoggerFactory").newInstance();
} catch (Exception e) {
throw new RuntimeException(
"Unexpected error when creating logger factory for \"" + libraryName + "\".", e);
}
} else { // Non-dynamically created factory
if (libraryEnum == LIBRARY_JAVA) {
return new _JULLoggerFactory();
} else if (libraryEnum == LIBRARY_NONE) {
return new _NullLoggerFactory();
} else {
throw new RuntimeException("Bug");
}
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
if (loggerFactoryWasAlreadySet) {
logWarnInLogger("Logger library was already set earlier to \""
+ getLibraryName(replacedLibraryEnum) + "\"; "
+ "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
+ "earlier.");
+ getLibraryName(libraryEnum)
+ "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
+ "\" system property is set to \"" + getLibraryName(Logger.libraryEnum) + "\".");
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* @throws ClassNotFoundException
* If the required logger library is not available.
*/
private static LoggerFactory createLoggerFactoryForNonAuto(int libraryEnum) throws ClassNotFoundException {
final String availabilityCheckClassName = getAvailabilityCheckClassName(libraryEnum);
if (availabilityCheckClassName != null) { // Dynamically created factory
Class.forName(availabilityCheckClassName);
String libraryName = getLibraryName(libraryEnum);
try {
return (LoggerFactory) Class.forName(
"freemarker.log._" + libraryName + "LoggerFactory").newInstance();
} catch (Exception e) {
throw new RuntimeException(
"Unexpected error when creating logger factory for \"" + libraryName + "\".", e);
}
} else { // Non-dynamically created factory
if (libraryEnum == LIBRARY_JAVA) {
return new _JULLoggerFactory();
} else if (libraryEnum == LIBRARY_NONE) {
return new _NullLoggerFactory();
} else {
throw new RuntimeException("Bug");
}
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
int matchedEnum = MIN_LIBRARY_ENUM;
do {
if (sysPropVal.equalsIgnoreCase(getLibraryName(matchedEnum))) {
foundMatch = true;
} else {
final boolean disableLogging = !(onlyIfCanBeSetFromSysProp && sysPropVal != null);
logErrorInLogger(
"Couldn't set up logger for \"" + getLibraryName(libraryEnum) + "\""
+ (disableLogging ? "; logging disabled" : "."), e);
if (disableLogging) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
int matchedEnum = MIN_LIBRARY_ENUM;
do {
if (sysPropVal.equalsIgnoreCase(getLibraryName(matchedEnum))) {
foundMatch = true;
} else {
final boolean disableLogging = !(onlyIfCanBeSetFromSysProp && sysPropVal != null);
logErrorInLogger(
"Couldn't set up logger for \"" + getLibraryName(libraryEnum) + "\""
+ (disableLogging ? "; logging disabled" : "."), e);
if (disableLogging) {
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* @throws ClassNotFoundException
* If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
*/
private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
if (libraryEnum == LIBRARY_AUTO) {
for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
if (!isAutoDetected(libraryEnumToTry)) continue;
if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
libraryEnumToTry = LIBRARY_SLF4J;
}
try {
return createLoggerFactoryForNonAuto(libraryEnumToTry);
} catch (ClassNotFoundException e) {
// Expected, intentionally suppressed.
} catch (Throwable e) {
logErrorInLogger(
"Unexpected error when initializing logging for \""
+ getLibraryName(libraryEnumToTry) + "\".",
e);
}
}
logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
return new _NullLoggerFactory();
} else {
return createLoggerFactoryForNonAuto(libraryEnum);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* @throws ClassNotFoundException
* If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
*/
private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
if (libraryEnum == LIBRARY_AUTO) {
for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
if (!isAutoDetected(libraryEnumToTry)) continue;
if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
libraryEnumToTry = LIBRARY_SLF4J;
}
try {
return createLoggerFactoryForNonAuto(libraryEnumToTry);
} catch (ClassNotFoundException e) {
// Expected, intentionally suppressed.
} catch (Throwable e) {
logErrorInLogger(
"Unexpected error when initializing logging for \""
+ getLibraryName(libraryEnumToTry) + "\".",
e);
}
}
logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
return new _NullLoggerFactory();
} else {
return createLoggerFactoryForNonAuto(libraryEnum);
}
}
内容来源于网络,如有侵权,请联系作者删除!