Search in sources :

Example 6 with ServiceLoggingContext

use of io.cdap.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class LogSaverStatusService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.LOGSAVER));
    httpService.start();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(URIScheme.createDiscoverable(Constants.Service.LOGSAVER, httpService)));
}
Also used : ServiceLoggingContext(io.cdap.cdap.common.logging.ServiceLoggingContext)

Example 7 with ServiceLoggingContext

use of io.cdap.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class MetricsQueryService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS));
    LOG.info("Starting Metrics Service...");
    httpService.start();
    LOG.info("Started Metrics HTTP Service...");
    // Register the service
    cancelDiscovery = discoveryService.register(ResolvingDiscoverable.of(URIScheme.createDiscoverable(Constants.Service.METRICS, httpService)));
    LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress());
}
Also used : ServiceLoggingContext(io.cdap.cdap.common.logging.ServiceLoggingContext)

Example 8 with ServiceLoggingContext

use of io.cdap.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class MetricsProcessorStatusService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR));
    LOG.info("Starting MetricsProcessor Status Service...");
    httpService.start();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(URIScheme.createDiscoverable(Constants.Service.METRICS_PROCESSOR, httpService)));
    LOG.info("Started MetricsProcessor Status Service.");
}
Also used : ServiceLoggingContext(io.cdap.cdap.common.logging.ServiceLoggingContext)

Example 9 with ServiceLoggingContext

use of io.cdap.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class MessagingServiceTwillRunnable method doInit.

@Override
protected Injector doInit(TwillContext context) {
    CConfiguration cConf = getCConfiguration();
    cConf.set(Constants.MessagingSystem.HTTP_SERVER_BIND_ADDRESS, context.getHost().getHostName());
    cConf.setInt(Constants.MessagingSystem.CONTAINER_INSTANCE_ID, context.getInstanceId());
    injector = createInjector(cConf, getConfiguration());
    injector.getInstance(LogAppenderInitializer.class).initialize();
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.MESSAGING_SERVICE));
    return injector;
}
Also used : LogAppenderInitializer(io.cdap.cdap.logging.appender.LogAppenderInitializer) ServiceLoggingContext(io.cdap.cdap.common.logging.ServiceLoggingContext) CConfiguration(io.cdap.cdap.common.conf.CConfiguration)

Example 10 with ServiceLoggingContext

use of io.cdap.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class MetricsProcessorTwillRunnable method doInit.

@Override
protected Injector doInit(TwillContext context) {
    getCConfiguration().set(Constants.MetricsProcessor.BIND_ADDRESS, context.getHost().getCanonicalHostName());
    // Set the hostname of the machine so that cConf can be used to start internal services
    LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName());
    instanceId = context.getInstanceId();
    String txClientId = String.format("cdap.service.%s.%d", Constants.Service.METRICS_PROCESSOR, context.getInstanceId());
    injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId, context);
    injector.getInstance(LogAppenderInitializer.class).initialize();
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR));
    return injector;
}
Also used : LogAppenderInitializer(io.cdap.cdap.logging.appender.LogAppenderInitializer) ServiceLoggingContext(io.cdap.cdap.common.logging.ServiceLoggingContext)

Aggregations

ServiceLoggingContext (io.cdap.cdap.common.logging.ServiceLoggingContext)46 LogAppenderInitializer (io.cdap.cdap.logging.appender.LogAppenderInitializer)20 CConfiguration (io.cdap.cdap.common.conf.CConfiguration)18 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)12 LoggingContext (io.cdap.cdap.common.logging.LoggingContext)12 Configuration (org.apache.hadoop.conf.Configuration)12 Injector (com.google.inject.Injector)10 File (java.io.File)10 AbstractIdleService (com.google.common.util.concurrent.AbstractIdleService)6 ImmutableList (com.google.common.collect.ImmutableList)4 Service (com.google.common.util.concurrent.Service)4 ProgramRuntimeService (io.cdap.cdap.app.runtime.ProgramRuntimeService)4 SConfiguration (io.cdap.cdap.common.conf.SConfiguration)4 IOException (java.io.IOException)4 TransactionRunner (io.cdap.cdap.spi.data.transaction.TransactionRunner)3 NettyHttpService (io.cdap.http.NettyHttpService)3 ArrayList (java.util.ArrayList)3 DiscoveryService (org.apache.twill.discovery.DiscoveryService)3 LoggerContext (ch.qos.logback.classic.LoggerContext)2 MetricDataQuery (io.cdap.cdap.api.metrics.MetricDataQuery)2