private synchronized AppenderControl getControl(final String key, final LogEvent event) { AppenderControl control = appenders.get(key); if (control != null) { return control; } Route route = null; for (final Route r : routes.getRoutes()) { if (r.getAppenderRef() == null && key.equals(r.getKey())) { route = r; break; } } if (route == null) { route = defaultRoute; control = appenders.get(DEFAULT_KEY); if (control != null) { return control; } } if (route != null) { final Appender app = createAppender(route, event); if (app == null) { return null; } control = new AppenderControl(app, null, null); appenders.put(key, control); } return control; }
if (route.getAppenderRef() != null) { final Appender appender = configuration.getAppender(route.getAppenderRef()); if (appender != null) { final String key = route == defaultRoute ? DEFAULT_KEY : route.getKey(); appenders.put(key, new AppenderControl(appender, null, null)); } else { error("Appender " + route.getAppenderRef() + " cannot be located. Route ignored");