private static ContextSelector createContextSelector() { try { final ContextSelector selector = LoaderUtil.newCheckedInstanceOfProperty(Constants.LOG4J_CONTEXT_SELECTOR, ContextSelector.class); if (selector != null) { return selector; } } catch (final Exception e) { LOGGER.error("Unable to create custom ContextSelector. Falling back to default.", e); } return new ClassLoaderContextSelector(); }
private static ShutdownCallbackRegistry createShutdownCallbackRegistry() { try { final ShutdownCallbackRegistry registry = LoaderUtil.newCheckedInstanceOfProperty( ShutdownCallbackRegistry.SHUTDOWN_CALLBACK_REGISTRY, ShutdownCallbackRegistry.class ); if (registry != null) { return registry; } } catch (final Exception e) { LOGGER.error("Unable to create custom ShutdownCallbackRegistry. Falling back to default.", e); } return new DefaultShutdownCallbackRegistry(); }