本文整理了Java中freemarker.log.Logger.getLogger()
方法的一些代码示例,展示了Logger.getLogger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.getLogger()
方法的具体详情如下:
包路径:freemarker.log.Logger
类名称:Logger
方法名:getLogger
[英]Returns a logger for the specified category.
[中]返回指定类别的记录器。
代码示例来源:origin: org.freemarker/freemarker
private static void logInLogger(boolean error, String message, Throwable exception) {
boolean canUseRealLogger;
synchronized (Logger.class) {
canUseRealLogger = loggerFactory != null && !(loggerFactory instanceof _NullLoggerFactory);
}
if (canUseRealLogger) {
try {
final Logger logger = Logger.getLogger("freemarker.logger");
if (error) {
logger.error(message);
} else {
logger.warn(message);
}
} catch (Throwable e) {
canUseRealLogger = false;
}
}
if (!canUseRealLogger) {
System.err.println((error ? "ERROR" : "WARN") + " "
+ LoggerFactory.class.getName() + ": " + message);
if (exception != null) {
System.err.println("\tException: " + tryToString(exception));
while (exception.getCause() != null) {
exception = exception.getCause();
System.err.println("\tCaused by: " + tryToString(exception));
}
}
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
private static void logInLogger(boolean error, String message, Throwable exception) {
boolean canUseRealLogger;
synchronized (Logger.class) {
canUseRealLogger = loggerFactory != null && !(loggerFactory instanceof _NullLoggerFactory);
}
if (canUseRealLogger) {
try {
final Logger logger = Logger.getLogger("freemarker.logger");
if (error) {
logger.error(message);
} else {
logger.warn(message);
}
} catch (Throwable e) {
canUseRealLogger = false;
}
}
if (!canUseRealLogger) {
System.err.println((error ? "ERROR" : "WARN") + " "
+ LoggerFactory.class.getName() + ": " + message);
if (exception != null) {
System.err.println("\tException: " + tryToString(exception));
while (exception.getCause() != null) {
exception = exception.getCause();
System.err.println("\tCaused by: " + tryToString(exception));
}
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
private static void logInLogger(boolean error, String message, Throwable exception) {
boolean canUseRealLogger;
synchronized (Logger.class) {
canUseRealLogger = loggerFactory != null && !(loggerFactory instanceof _NullLoggerFactory);
}
if (canUseRealLogger) {
try {
final Logger logger = Logger.getLogger("freemarker.logger");
if (error) {
logger.error(message);
} else {
logger.warn(message);
}
} catch (Throwable e) {
canUseRealLogger = false;
}
}
if (!canUseRealLogger) {
System.err.println((error ? "ERROR" : "WARN") + " "
+ LoggerFactory.class.getName() + ": " + message);
if (exception != null) {
System.err.println("\tException: " + tryToString(exception));
while (exception.getCause() != null) {
exception = exception.getCause();
System.err.println("\tCaused by: " + tryToString(exception));
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!