private boolean isAlreadyInitialized(LoggerContext loggerContext) { return LoggingSystem.class.getName().equals(loggerContext.getExternalContext()); }
@Override public Configuration getConfiguration(LoggerContext loggerContext, ConfigurationSource source) { if (source != null && source != ConfigurationSource.NULL_SOURCE) { return loggerContext.getExternalContext() != null ? new SOFAConfiguration() : new XmlConfiguration(loggerContext, source); } return null; }
@Override public LoggerContext getContext(String fqcn, ClassLoader loader, Object externalContext, boolean currentContext) { final LoggerContext ctx = customLoggerContext; if(externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext); } if(ctx.getState() == LifeCycle.State.INITIALIZED) { ctx.start(); } return ctx; }
/** * Loads the LoggerContext using the ContextSelector using the provided Configuration * @param fqcn The fully qualified class name of the caller. * @param loader The ClassLoader to use or null. * @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext. * @param currentContext If true returns the current Context, if false returns the Context appropriate * for the caller if a more appropriate Context can be determined. * @param configuration The Configuration. * @return The LoggerContext. */ public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext, final boolean currentContext, final Configuration configuration) { final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, null); if (externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext); } if (ctx.getState() == LifeCycle.State.INITIALIZED) { ContextAnchor.THREAD_CONTEXT.set(ctx); try { ctx.start(configuration); } finally { ContextAnchor.THREAD_CONTEXT.remove(); } } return ctx; }
/** * Loads the LoggerContext using the ContextSelector. * @param fqcn The fully qualified class name of the caller. * @param loader The ClassLoader to use or null. * @param currentContext If true returns the current Context, if false returns the Context appropriate * for the caller if a more appropriate Context can be determined. * @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext. * @return The LoggerContext. */ @Override public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext, final boolean currentContext) { final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext); if (externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext); } if (ctx.getState() == LifeCycle.State.INITIALIZED) { ctx.start(); } return ctx; }
final LoggerContext ctx = selector if (externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext);
@Override public LoggerContext getContext(String fqcn, ClassLoader loader, Object externalContext, boolean currentContext, URI configLocation, String name) { final LoggerContext ctx = customLoggerContext; if (externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext); } if (name != null) { ctx.setName(name); } if (ctx.getState() == LifeCycle.State.INITIALIZED) { if (configLocation != null || name != null) { THREAD_CONTEXT.set(ctx); final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation); StatusLogger.getLogger().debug("Starting LoggerContext[name={}] from configuration at {}", ctx.getName(), configLocation); ctx.start(config); THREAD_CONTEXT.remove(); } else { ctx.start(); } } return ctx; } }
/** * Loads the LoggerContext using the ContextSelector. * @param fqcn The fully qualified class name of the caller. * @param loader The ClassLoader to use or null. * @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext. * @param currentContext If true returns the current Context, if false returns the Context appropriate * for the caller if a more appropriate Context can be determined. * @param source The configuration source. * @return The LoggerContext. */ public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext, final boolean currentContext, final ConfigurationSource source) { final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, null); if (externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext); } if (ctx.getState() == LifeCycle.State.INITIALIZED) { if (source != null) { ContextAnchor.THREAD_CONTEXT.set(ctx); final Configuration config = ConfigurationFactory.getInstance().getConfiguration(ctx, source); LOGGER.debug("Starting LoggerContext[name={}] from configuration {}", ctx.getName(), source); ctx.start(config); ContextAnchor.THREAD_CONTEXT.remove(); } else { ctx.start(); } } return ctx; }
final boolean currentContext, final URI configLocation, final String name) { final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, configLocation); if (externalContext != null && ctx.getExternalContext() == null) { ctx.setExternalContext(externalContext);