Search in sources :

Example 11 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class RemoteSystemOperationsService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.REMOTE_SYSTEM_OPERATION));
    LOG.info("Starting RemoteSystemOperationService...");
    httpService.startAndWait();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(new Discoverable(Constants.Service.REMOTE_SYSTEM_OPERATION, httpService.getBindAddress())));
    LOG.info("RemoteSystemOperationService started successfully on {}", httpService.getBindAddress());
}
Also used : Discoverable(org.apache.twill.discovery.Discoverable) ResolvingDiscoverable(co.cask.cdap.common.discovery.ResolvingDiscoverable) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 12 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class DatasetOpExecutorService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR));
    LOG.info("Starting DatasetOpExecutorService...");
    httpService.startAndWait();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress())));
    LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress());
}
Also used : Discoverable(org.apache.twill.discovery.Discoverable) ResolvingDiscoverable(co.cask.cdap.common.discovery.ResolvingDiscoverable) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 13 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class DefaultPreviewRunner method startUp.

@Override
protected void startUp() throws Exception {
    if (messagingService instanceof Service) {
        ((Service) messagingService).startAndWait();
    }
    datasetService.startAndWait();
    // It is recommended to initialize log appender after datasetService is started,
    // since log appender instantiates a dataset.
    logAppenderInitializer.initialize();
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.PREVIEW_HTTP));
    Futures.allAsList(applicationLifecycleService.start(), systemArtifactLoader.start(), programRuntimeService.start(), programLifecycleService.start(), metricsCollectionService.start()).get();
}
Also used : MessagingService(co.cask.cdap.messaging.MessagingService) MetricsCollectionService(co.cask.cdap.api.metrics.MetricsCollectionService) ProgramRuntimeService(co.cask.cdap.app.runtime.ProgramRuntimeService) ProgramLifecycleService(co.cask.cdap.internal.app.services.ProgramLifecycleService) AbstractIdleService(com.google.common.util.concurrent.AbstractIdleService) ApplicationLifecycleService(co.cask.cdap.internal.app.services.ApplicationLifecycleService) DatasetService(co.cask.cdap.data2.datafabric.dataset.service.DatasetService) Service(com.google.common.util.concurrent.Service) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 14 with ServiceLoggingContext

use of co.cask.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.startAndWait();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOGSAVER, httpService.getBindAddress())));
}
Also used : Discoverable(org.apache.twill.discovery.Discoverable) ResolvingDiscoverable(co.cask.cdap.common.discovery.ResolvingDiscoverable) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 15 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class MetricsTwillRunnable method doInit.

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

Aggregations

ServiceLoggingContext (co.cask.cdap.common.logging.ServiceLoggingContext)20 ResolvingDiscoverable (co.cask.cdap.common.discovery.ResolvingDiscoverable)8 Discoverable (org.apache.twill.discovery.Discoverable)8 LogAppenderInitializer (co.cask.cdap.logging.appender.LogAppenderInitializer)7 CConfiguration (co.cask.cdap.common.conf.CConfiguration)5 ImmutableList (com.google.common.collect.ImmutableList)3 Configuration (org.apache.hadoop.conf.Configuration)3 MetricsCollectionService (co.cask.cdap.api.metrics.MetricsCollectionService)2 LoggingContext (co.cask.cdap.common.logging.LoggingContext)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 LoggerContext (ch.qos.logback.classic.LoggerContext)1 CloseableIterator (co.cask.cdap.api.dataset.lib.CloseableIterator)1 MetricDataQuery (co.cask.cdap.api.metrics.MetricDataQuery)1 MetricStore (co.cask.cdap.api.metrics.MetricStore)1 ProgramRuntimeService (co.cask.cdap.app.runtime.ProgramRuntimeService)1 CommonNettyHttpServiceBuilder (co.cask.cdap.common.http.CommonNettyHttpServiceBuilder)1 ApplicationLoggingContext (co.cask.cdap.common.logging.ApplicationLoggingContext)1 ComponentLoggingContext (co.cask.cdap.common.logging.ComponentLoggingContext)1 NamespaceLoggingContext (co.cask.cdap.common.logging.NamespaceLoggingContext)1