Codota Logo
NDC
Code IndexAdd Codota to your IDE (free)

How to use
NDC
in
org.jboss.logging

Best Java code snippets using org.jboss.logging.NDC (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: wildfly/wildfly

  public Object processInvocation(final InterceptorContext context) throws Exception {
    final Map<String, Object> mdc = MDC.getMap();
    if(mdc != null){
      context.putPrivateData(KEY, new StoredLogDiagnosticContext(mdc, NDC.get()));
      try {
        return context.proceed();
      } finally {
        context.putPrivateData(KEY, null);
      }
    } else {
      return context.proceed();
    }
  }
}
origin: wildfly/wildfly

  public Object processInvocation(final InterceptorContext context) throws Exception {
    final Map<String, Object> mdc = MDC.getMap();
    if (mdc != null) {
      for (String str : mdc.keySet()) {
        MDC.remove(str);
      }
    }
    final StoredLogDiagnosticContext data = (StoredLogDiagnosticContext) context.getPrivateData(KEY);
    context.putPrivateData(KEY, null);
    if (data != null && data.getMdc() != null) {
      for (Map.Entry<String, Object> entry : data.getMdc().entrySet()) {
        MDC.put(entry.getKey(), entry.getValue());
      }
      final int depth = NDC.getDepth();
      NDC.push(data.getNdc());
      try {
        return context.proceed();
      } finally {
        NDC.setMaxDepth(depth);
        for (String str : MDC.getMap().keySet()) {
          MDC.remove(str);
        }
      }
    }
    return context.proceed();
  }
}
origin: NationalSecurityAgency/datawave

private void addNDC() {
  String user = this.settings.getUserDN();
  UUID uuid = this.settings.getId();
  if (user != null && uuid != null) {
    NDC.push("[" + user + "] [" + uuid + "]");
  }
}

origin: NationalSecurityAgency/datawave

private void removeNDC() {
  NDC.pop();
}

origin: org.jboss.logging/jboss-logging-jdk

 public String convert(LogRecord event)
 {
   switch (type)
   {
    case RELATIVE_TIME_CONVERTER:
      return (Long.toString(event.getMillis() - startTime));
    case THREAD_CONVERTER:
      StringBuffer tmp = new StringBuffer("tid(");
      tmp.append(event.getThreadID());
      tmp.append(')');
      return tmp.toString();
    case THREAD_NAME_CONVERTER:
      // @todo figure how to map the thread id to its name
      return "null";
    case LEVEL_CONVERTER:
      return event.getLevel().toString();
    case NDC_CONVERTER:
      // For now rely on the thread local
      return NDC.get();
    case MESSAGE_CONVERTER:
    {
      return event.getMessage();
    }
    default:
      return null;
   }
 }
}
org.jboss.loggingNDC

Javadoc

A "Nested Diagnostic Context" abstraction.

Most used methods

  • get
    Retrieves the current values set for the nested diagnostics context.
  • push
    Pushes a value to the nested diagnostics context stack.
  • getDepth
    The current depth of the nested diagnostics context.
  • pop
    Pops top value from the stack and returns it.
  • setMaxDepth
    Sets maximum depth of the stack removing any entries below the maximum depth.

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • getContentResolver (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • String (java.lang)
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now