use of org.apache.logging.log4j.Logger in project elasticsearch by elastic.
the class LoggingListener method reset.
/**
* Reset the logging levels to the state provided by the map.
*
* @param map the logging levels to apply
* @return an empty map
*/
private Map<String, String> reset(final Map<String, String> map) {
for (final Map.Entry<String, String> previousLogger : map.entrySet()) {
final Logger logger = resolveLogger(previousLogger.getKey());
Loggers.setLevel(logger, previousLogger.getValue());
}
return Collections.emptyMap();
}
use of org.apache.logging.log4j.Logger in project elasticsearch by elastic.
the class Node method stop.
private Node stop() {
if (!lifecycle.moveToStopped()) {
return this;
}
Logger logger = Loggers.getLogger(Node.class, NODE_NAME_SETTING.get(settings));
logger.info("stopping ...");
injector.getInstance(TribeService.class).stop();
injector.getInstance(ResourceWatcherService.class).stop();
if (NetworkModule.HTTP_ENABLED.get(settings)) {
injector.getInstance(HttpServerTransport.class).stop();
}
injector.getInstance(SnapshotsService.class).stop();
injector.getInstance(SnapshotShardsService.class).stop();
// stop any changes happening as a result of cluster state changes
injector.getInstance(IndicesClusterStateService.class).stop();
// close discovery early to not react to pings anymore.
// This can confuse other nodes and delay things - mostly if we're the master and we're running tests.
injector.getInstance(Discovery.class).stop();
// we close indices first, so operations won't be allowed on it
injector.getInstance(RoutingService.class).stop();
injector.getInstance(ClusterService.class).stop();
injector.getInstance(NodeConnectionsService.class).stop();
injector.getInstance(MonitorService.class).stop();
injector.getInstance(GatewayService.class).stop();
injector.getInstance(SearchService.class).stop();
injector.getInstance(TransportService.class).stop();
injector.getInstance(SearchTransportService.class).stop();
pluginLifecycleComponents.forEach(LifecycleComponent::stop);
// we should stop this last since it waits for resources to get released
// if we had scroll searchers etc or recovery going on we wait for to finish.
injector.getInstance(IndicesService.class).stop();
logger.info("stopped");
return this;
}
use of org.apache.logging.log4j.Logger in project elasticsearch by elastic.
the class Bootstrap method checkUnsetAndMaybeExit.
private static void checkUnsetAndMaybeExit(String confFileSetting, String settingName) {
if (confFileSetting != null && confFileSetting.isEmpty() == false) {
Logger logger = Loggers.getLogger(Bootstrap.class);
logger.info("{} is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed.", settingName);
exit(1);
}
}
use of org.apache.logging.log4j.Logger in project elasticsearch by elastic.
the class ElasticsearchUncaughtExceptionHandler method onFatalUncaught.
// visible for testing
void onFatalUncaught(final String threadName, final Throwable t) {
final Logger logger = Loggers.getLogger(ElasticsearchUncaughtExceptionHandler.class, loggingPrefixSupplier.get());
logger.error((org.apache.logging.log4j.util.Supplier<?>) () -> new ParameterizedMessage("fatal error in thread [{}], exiting", threadName), t);
}
use of org.apache.logging.log4j.Logger in project elasticsearch by elastic.
the class JarHell method checkJarHell.
/**
* Checks the current classpath for duplicate classes
* @throws IllegalStateException if jar hell was found
*/
public static void checkJarHell() throws IOException, URISyntaxException {
ClassLoader loader = JarHell.class.getClassLoader();
Logger logger = Loggers.getLogger(JarHell.class);
if (logger.isDebugEnabled()) {
logger.debug("java.class.path: {}", System.getProperty("java.class.path"));
logger.debug("sun.boot.class.path: {}", System.getProperty("sun.boot.class.path"));
if (loader instanceof URLClassLoader) {
logger.debug("classloader urls: {}", Arrays.toString(((URLClassLoader) loader).getURLs()));
}
}
checkJarHell(parseClassPath());
}
Aggregations