本文整理汇总了Java中org.apache.logging.log4j.spi.AbstractLogger.checkMessageFactory方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractLogger.checkMessageFactory方法的具体用法?Java AbstractLogger.checkMessageFactory怎么用?Java AbstractLogger.checkMessageFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.logging.log4j.spi.AbstractLogger
的用法示例。
在下文中一共展示了AbstractLogger.checkMessageFactory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLogger
import org.apache.logging.log4j.spi.AbstractLogger; //导入方法依赖的package包/类
@Override
public Log4jTaglibLogger getLogger(final String name, final MessageFactory factory) {
Log4jTaglibLogger logger = this.loggers.get(name);
if (logger != null) {
AbstractLogger.checkMessageFactory(logger, factory);
return logger;
}
synchronized (this.loggers) {
logger = this.loggers.get(name);
if (logger == null) {
final Logger original = factory == null ?
LogManager.getLogger(name) : LogManager.getLogger(name, factory);
if (!(original instanceof AbstractLogger)) {
throw new LoggingException(
"Log4j Tag Library requires base logging system to extend Log4j AbstractLogger."
);
}
// wrap a logger from an underlying implementation
logger = new Log4jTaglibLogger((AbstractLogger) original, name, original.getMessageFactory());
this.loggers.put(name, logger);
}
}
return logger;
}
示例2: getLogger
import org.apache.logging.log4j.spi.AbstractLogger; //导入方法依赖的package包/类
@Override
public Log4jTaglibLogger getLogger(final String name, final MessageFactory messageFactory) {
// Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
Log4jTaglibLogger logger = this.loggerRegistry.getLogger(name, messageFactory);
if (logger != null) {
AbstractLogger.checkMessageFactory(logger, messageFactory);
return logger;
}
synchronized (this.loggerRegistry) {
logger = this.loggerRegistry.getLogger(name, messageFactory);
if (logger == null) {
final LoggerContext context = LogManager.getContext(false);
final ExtendedLogger original = messageFactory == null ?
context.getLogger(name) : context.getLogger(name, messageFactory);
// wrap a logger from an underlying implementation
logger = new Log4jTaglibLogger(original, name, original.getMessageFactory());
this.loggerRegistry.putIfAbsent(name, messageFactory, logger);
}
}
return logger;
}
示例3: getLogger
import org.apache.logging.log4j.spi.AbstractLogger; //导入方法依赖的package包/类
@Override
public Logger getLogger(final String name, final MessageFactory messageFactory) {
if (loggers.containsKey(name)) {
final Logger logger = loggers.get(name);
AbstractLogger.checkMessageFactory(logger, messageFactory);
return logger;
}
loggers.putIfAbsent(name, new SimpleLogger(name, defaultLevel, showLogName, showShortName, showDateTime,
showContextMap, dateTimeFormat, messageFactory, props, stream));
return loggers.get(name);
}
示例4: getLogger
import org.apache.logging.log4j.spi.AbstractLogger; //导入方法依赖的package包/类
/**
* Obtain a Logger from the Context.
* @param name The name of the Logger to return.
* @param messageFactory The message factory is used only when creating a
* logger, subsequent use does not change the logger but will log
* a warning if mismatched.
* @return The Logger.
*/
@Override
public Logger getLogger(final String name, final MessageFactory messageFactory) {
Logger logger = loggers.get(name);
if (logger != null) {
AbstractLogger.checkMessageFactory(logger, messageFactory);
return logger;
}
logger = newInstance(this, name, messageFactory);
final Logger prev = loggers.putIfAbsent(name, logger);
return prev == null ? logger : prev;
}
示例5: getLogger
import org.apache.logging.log4j.spi.AbstractLogger; //导入方法依赖的package包/类
@Override
public ExtendedLogger getLogger(final String name, final MessageFactory messageFactory) {
// Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
final ExtendedLogger extendedLogger = loggerRegistry.getLogger(name, messageFactory);
if (extendedLogger != null) {
AbstractLogger.checkMessageFactory(extendedLogger, messageFactory);
return extendedLogger;
}
final SimpleLogger simpleLogger = new SimpleLogger(name, defaultLevel, showLogName, showShortName, showDateTime,
showContextMap, dateTimeFormat, messageFactory, props, stream);
loggerRegistry.putIfAbsent(name, messageFactory, simpleLogger);
return loggerRegistry.getLogger(name, messageFactory);
}
示例6: getLogger
import org.apache.logging.log4j.spi.AbstractLogger; //导入方法依赖的package包/类
/**
* Obtains a Logger from the Context.
*
* @param name The name of the Logger to return.
* @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
* logger but will log a warning if mismatched.
* @return The Logger.
*/
@Override
public Logger getLogger(final String name, final MessageFactory messageFactory) {
// Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
Logger logger = loggerRegistry.getLogger(name, messageFactory);
if (logger != null) {
AbstractLogger.checkMessageFactory(logger, messageFactory);
return logger;
}
logger = newInstance(this, name, messageFactory);
loggerRegistry.putIfAbsent(name, messageFactory, logger);
return loggerRegistry.getLogger(name, messageFactory);
}