use of org.apache.log4j.or.ObjectRenderer in project logging-log4j2 by apache.
the class Category method get.
private <T> ObjectRenderer get(final Class<T> clazz) {
ObjectRenderer renderer = null;
for (Class<? super T> c = clazz; c != null; c = c.getSuperclass()) {
renderer = rendererMap.get(c);
if (renderer != null) {
return renderer;
}
renderer = searchInterfaces(c);
if (renderer != null) {
return renderer;
}
}
return null;
}
use of org.apache.log4j.or.ObjectRenderer in project logging-log4j2 by apache.
the class Category method searchInterfaces.
ObjectRenderer searchInterfaces(final Class<?> c) {
ObjectRenderer renderer = rendererMap.get(c);
if (renderer != null) {
return renderer;
}
final Class<?>[] ia = c.getInterfaces();
for (final Class<?> clazz : ia) {
renderer = searchInterfaces(clazz);
if (renderer != null) {
return renderer;
}
}
return null;
}
use of org.apache.log4j.or.ObjectRenderer in project logging-log4j2 by apache.
the class Category method forcedLog.
public void forcedLog(final String fqcn, final Priority level, final Object message, final Throwable t) {
final org.apache.logging.log4j.Level lvl = org.apache.logging.log4j.Level.toLevel(level.toString());
if (logger instanceof ExtendedLogger) {
@SuppressWarnings("unchecked") final Message msg = message instanceof Message ? (Message) message : message instanceof Map ? new MapMessage((Map) message) : new ObjectMessage(message);
((ExtendedLogger) logger).logMessage(fqcn, lvl, null, msg, t);
} else {
final ObjectRenderer renderer = get(message.getClass());
final Message msg = message instanceof Message ? (Message) message : renderer != null ? new RenderedMessage(renderer, message) : new ObjectMessage(message);
logger.log(lvl, msg, t);
}
}
Aggregations