@Override
public void format(LoggingEvent event, StringBuffer toAppendTo) {
boolean appended = false;
if (event instanceof FoundationLof4jLoggingEvent) { // So we can call get marker
FoundationLof4jLoggingEvent foundationLof4jLoggingEvent = (FoundationLof4jLoggingEvent) event;
Marker marker = foundationLof4jLoggingEvent.getSlf4jMarker();
if (marker instanceof FoundationLoggingMarker) { // So this converter may
// uses internal pattern
// that is composed
// layout of %u{}
FoundationLoggingMarker foundationMarker = (FoundationLoggingMarker) marker;
String pattern = foundationMarker.getFormatter().getFormat(foundationLof4jLoggingEvent.getAppenderName());
if (pattern != null) { // only if we have pattern from one of
// two options
if (layoutsMap.get(pattern) == null) {
layoutsMap.put(pattern, new FoundationLoggingPatternLayout(pattern));