Java Code Examples for org.elasticsearch.common.logging.ESLogger#info()

The following examples show how to use org.elasticsearch.common.logging.ESLogger#info() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Elasticsearch   File: BootstrapProxy.java    License: Apache License 2.0 5 votes vote down vote up
private static void checkUnsetAndMaybeExit(String confFileSetting, String settingName) {
    if (confFileSetting != null && confFileSetting.isEmpty() == false) {
        ESLogger logger = Loggers.getLogger(Bootstrap.class);
        logger.info("{} is no longer supported. crate.yml must be placed in the config directory and cannot be renamed.", settingName);
        System.exit(1);
    }
}
 
Example 2
Source Project: Elasticsearch   File: CrateF.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    System.setProperty("es.foreground", "yes");
    String[] startArgs = new String[args.length + 1];
    startArgs[0] = "start";
    System.arraycopy(args, 0, startArgs, 1, args.length);
    try {
        BootstrapProxy.init(startArgs);
    } catch (Throwable t) {
        // format exceptions to the console in a special way
        // to avoid 2MB stacktraces from guice, etc.
        throw new StartupErrorProxy(t);
    }

    // start mysql server
    Settings settings = BootstrapProxy.getSettings();
    int maxConectNum = settings.getAsInt("mysql.max_connections", 1024);
    int mysqlPort = settings.getAsInt("mysql.port", 8306);
    ConnectScheduler scheduler = new ConnectScheduler(maxConectNum);
    MysqlServer mysqlServer = new MysqlServer(mysqlPort, scheduler);
    ESLogger logger = Loggers.getLogger(CrateF.class);
    if (!mysqlServer.start()) {
        logger.error("mysql server start failed");
        System.exit(-1);
    } else {
        logger.info("mysql server start successful, max_connections: "
                + maxConectNum + " port: " + mysqlPort);
    }
}
 
Example 3
Source Project: Elasticsearch   File: Node.java    License: Apache License 2.0 5 votes vote down vote up
private Node stop() {
    if (!lifecycle.moveToStopped()) {
        return this;
    }
    ESLogger logger = Loggers.getLogger(Node.class, settings.get("name"));
    logger.info("stopping ...");

    injector.getInstance(TribeService.class).stop();
    injector.getInstance(ResourceWatcherService.class).stop();
    if (settings.getAsBoolean("http.enabled", true)) {
        injector.getInstance(HttpServer.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();
    // we close indices first, so operations won't be allowed on it
    injector.getInstance(IndexingMemoryController.class).stop();
    injector.getInstance(IndicesTTLService.class).stop();
    injector.getInstance(RoutingService.class).stop();
    injector.getInstance(ClusterService.class).stop();
    injector.getInstance(DiscoveryService.class).stop();
    injector.getInstance(MonitorService.class).stop();
    injector.getInstance(GatewayService.class).stop();
    injector.getInstance(SearchService.class).stop();
    injector.getInstance(RestController.class).stop();
    injector.getInstance(TransportService.class).stop();

    for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
        injector.getInstance(plugin).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;
}
 
Example 4
Source Project: Elasticsearch   File: Bootstrap.java    License: Apache License 2.0 5 votes vote down vote up
private static void checkUnsetAndMaybeExit(String confFileSetting, String settingName) {
    if (confFileSetting != null && confFileSetting.isEmpty() == false) {
        ESLogger 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);
    }
}
 
Example 5
Source Project: elasticsearch-rest-command   File: Search.java    License: The Unlicense 5 votes vote down vote up
public static void buildTimeline(XContentBuilder builder,
		SearchResponse response, ESLogger logger) throws IOException {
	logger.info("Report took in millseconds:" + response.getTookInMillis());
	DateHistogram timeline = response.getAggregations().get(
			"data_over_time");

	// 格式化结果后输出

	builder.startObject();
	builder.field("took", response.getTookInMillis());
	builder.field("total", timeline.getBuckets().size());

	builder.startArray("fields");
	builder.value("_bucket_timevalue");
	builder.value("_doc_count");
	builder.endArray();

	builder.startArray("rows");
	for (Bucket bucket : timeline.getBuckets()) {
		builder.startArray();
		builder.value(bucket.getKey());
		builder.value(bucket.getDocCount());
		builder.endArray();
	}
	builder.endArray().endObject();

}
 
Example 6
Source Project: elasticsearch-rest-command   File: Search.java    License: The Unlicense 5 votes vote down vote up
static void dumpSearchScript(SearchRequestBuilder search, ESLogger logger) {

		try {
			XContentBuilder builder = XContentFactory
					.contentBuilder(XContentType.JSON);
			search.internalBuilder().toXContent(builder,
					ToXContent.EMPTY_PARAMS);
			logger.info(builder.bytes().toUtf8());

		} catch (IOException e) {
			logger.info(e.getMessage());
		}

	}
 
Example 7
Source Project: Elasticsearch   File: CrateRestFilter.java    License: Apache License 2.0 4 votes vote down vote up
@Inject
public CrateRestFilter(Settings settings) {
    this.esApiEnabled = settings.getAsBoolean(ES_API_ENABLED_SETTING, true);
    ESLogger logger = Loggers.getLogger(getClass().getPackage().getName(), settings);
    logger.info("Elasticsearch HTTP REST API {}enabled", esApiEnabled ? "" : "not ");
}
 
Example 8
Source Project: Elasticsearch   File: Node.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Start the node. If the node is already started, this method is no-op.
 */
public Node start() {
    if (!lifecycle.moveToStarted()) {
        return this;
    }

    ESLogger logger = Loggers.getLogger(Node.class, settings.get("name"));
    logger.info("starting ...");
    // hack around dependency injection problem (for now...)
    injector.getInstance(Discovery.class).setRoutingService(injector.getInstance(RoutingService.class));
    for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
        injector.getInstance(plugin).start();
    }

    injector.getInstance(MappingUpdatedAction.class).setClient(client);
    injector.getInstance(IndicesService.class).start();
    injector.getInstance(IndexingMemoryController.class).start();
    injector.getInstance(IndicesClusterStateService.class).start();
    injector.getInstance(IndicesTTLService.class).start();
    injector.getInstance(SnapshotsService.class).start();
    injector.getInstance(SnapshotShardsService.class).start();
    injector.getInstance(RoutingService.class).start();
    injector.getInstance(SearchService.class).start();
    injector.getInstance(MonitorService.class).start();
    injector.getInstance(RestController.class).start();

    // TODO hack around circular dependencies problems
    injector.getInstance(GatewayAllocator.class).setReallocation(injector.getInstance(ClusterService.class), injector.getInstance(RoutingService.class));

    injector.getInstance(ResourceWatcherService.class).start();
    injector.getInstance(GatewayService.class).start();
    injector.getInstance(TenantManagementService.class).start();

    // Start the transport service now so the publish address will be added to the local disco node in ClusterService
    TransportService transportService = injector.getInstance(TransportService.class);
    transportService.start();
    injector.getInstance(ClusterService.class).start();

    // start after cluster service so the local disco is known
    DiscoveryService discoService = injector.getInstance(DiscoveryService.class).start();


    transportService.acceptIncomingRequests();
    discoService.joinClusterAndWaitForInitialState();

    if (settings.getAsBoolean("http.enabled", true)) {
        injector.getInstance(HttpServer.class).start();
    }
    injector.getInstance(TribeService.class).start();
    if (settings.getAsBoolean("node.portsfile", false)) {
        if (settings.getAsBoolean("http.enabled", true)) {
            HttpServerTransport http = injector.getInstance(HttpServerTransport.class);
            writePortsFile("http", http.boundAddress());
        }
        TransportService transport = injector.getInstance(TransportService.class);
        writePortsFile("transport", transport.boundAddress());
    }
    logger.info("started");

    return this;
}