Tabnine Logo
LoggingContextAccessor.setLoggingContext
Code IndexAdd Tabnine to your IDE (free)

How to use
setLoggingContext
method
in
co.cask.cdap.common.logging.LoggingContextAccessor

Best Java code snippets using co.cask.cdap.common.logging.LoggingContextAccessor.setLoggingContext (Showing top 20 results out of 315)

origin: co.cask.cdap/cdap-app-fabric

/**
 * Returns the {@link MapReduceTaskContextProvider} associated with this ClassLoader.
 */
public MapReduceTaskContextProvider getTaskContextProvider() {
 // Logging context needs to be set in main thread.
 LoggingContext loggingContext = createMapReduceLoggingContext();
 LoggingContextAccessor.setLoggingContext(loggingContext);
 synchronized (this) {
  taskContextProvider = Optional.fromNullable(taskContextProvider).or(taskContextProviderSupplier);
 }
 taskContextProvider.startAndWait();
 return taskContextProvider;
}
origin: cdapio/cdap

@Override
protected void startUp() throws Exception {
 LoggingContextAccessor.setLoggingContext(loggingContext);
 runningThread = Thread.currentThread();
 createLocalDatasets();
 workflow = initializeWorkflow();
}
origin: cdapio/cdap

/**
 * Returns the {@link MapReduceTaskContextProvider} associated with this ClassLoader.
 */
public MapReduceTaskContextProvider getTaskContextProvider() {
 // Logging context needs to be set in main thread.
 LoggingContext loggingContext = createMapReduceLoggingContext();
 LoggingContextAccessor.setLoggingContext(loggingContext);
 synchronized (this) {
  taskContextProvider = Optional.fromNullable(taskContextProvider).or(taskContextProviderSupplier);
 }
 taskContextProvider.startAndWait();
 return taskContextProvider;
}
origin: co.cask.cdap/cdap-app-fabric

@Override
protected void startUp() throws Exception {
 LoggingContextAccessor.setLoggingContext(loggingContext);
 runningThread = Thread.currentThread();
 createLocalDatasets();
 workflow = initializeWorkflow();
}
origin: cdapio/cdap

@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;
}
origin: cdapio/cdap

@Override
protected Injector doInit(TwillContext context) {
 getCConfiguration().set(Constants.Transaction.Container.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());
 String txClientId = String.format("cdap.service.%s.%d", Constants.Service.TRANSACTION, 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.TRANSACTION));
 return injector;
}
origin: caskdata/cdap

@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(new Discoverable(Constants.Service.METRICS, httpService.getBindAddress())));
 LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress());
}
origin: co.cask.cdap/cdap-watchdog

@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(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress())));
 LOG.info("Started MetricsProcessor Status Service.");
}
origin: cdapio/cdap

@Override
protected Injector doInit(TwillContext context) {
 getCConfiguration().set(Constants.MetricsProcessor.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());
 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;
}
origin: caskdata/cdap

@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(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress())));
 LOG.info("Started MetricsProcessor Status Service.");
}
origin: co.cask.cdap/cdap-watchdog

@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(new Discoverable(Constants.Service.METRICS, httpService.getBindAddress())));
 LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress());
}
origin: cdapio/cdap

@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.start();
 cancellable = discoveryService.register(
  ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress())));
 LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress());
}
origin: co.cask.cdap/cdap-data-fabric

@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.start();
 cancellable = discoveryService.register(
  ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress())));
 LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress());
}
origin: co.cask.cdap/cdap-app-fabric

@Override
protected void shutDown() throws Exception {
 LoggingContextAccessor.setLoggingContext(flowletContext.getLoggingContext());
 if (flowletProcessDriver != null) {
  stopService(flowletProcessDriver);
 }
 destroyFlowlet();
 LOG.info("Stopped Flowlet '{}' Instance {} for Flow '{}'", flowletContext.getFlowletId(),
      flowletContext.getInstanceId(), flowletContext.getFlowId());
 stopService(serviceHook);
}
origin: cdapio/cdap

@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;
}
origin: co.cask.cdap/cdap-app-fabric

@Override
protected void startUp() throws Exception {
 LoggingContextAccessor.setLoggingContext(flowletContext.getLoggingContext());
 flowletContext.getProgramMetrics().increment("process.instance", 1);
 flowletProcessDriver = new FlowletProcessDriver(flowletContext, dataFabricFacade, txCallback, processSpecs);
 serviceHook.startAndWait();
 initFlowlet();
 flowletProcessDriver.startAndWait();
 LOG.info("Started Flowlet '{}' for Flow '{}'. Flowlet details: [{}]",
      flowletContext.getFlowletId(), flowletContext.getFlowId(), flowletContext);
}
origin: caskdata/cdap

@Override
protected void startUp() throws Exception {
 LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(),
                                   Constants.Logging.COMPONENT_NAME,
                                   Constants.Service.LOG_QUERY));
 httpServer.start();
 cancellable = discoveryService.register(
  ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOG_QUERY, httpServer.getBindAddress())));
}
origin: co.cask.cdap/cdap-data-fabric

 @Override
 protected void startUp() throws Exception {
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(),
                                    Constants.Logging.COMPONENT_NAME,
                                    Constants.Service.STREAMS));
  httpService.start();

  discoverable = ResolvingDiscoverable.of(new Discoverable(Constants.Service.STREAMS, httpService.getBindAddress()));
  cancellable = discoveryService.register(discoverable);
}

origin: co.cask.cdap/cdap-watchdog

@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(new Discoverable(Constants.Service.LOGSAVER, httpService.getBindAddress())));
}
origin: caskdata/cdap

@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(new Discoverable(Constants.Service.LOGSAVER, httpService.getBindAddress())));
}
co.cask.cdap.common.loggingLoggingContextAccessorsetLoggingContext

Javadoc

Sets the logging context.

NOTE: in work execution frameworks where threads are shared between workers (like Akka) we would have to init context very frequently (before every chunk of work is started). In that case we really want to re-use logging context object instance.

Popular methods of LoggingContextAccessor

  • getLoggingContext

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JPanel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now