Interface NDCProvider


  • public interface NDCProvider
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Clear the thread's NDC stack.
      String get()
      Get the current NDC value.
      String get​(int n)
      Provided for compatibility with log4j.
      int getDepth()
      Get the current NDC stack depth.
      String pop()
      Pop the topmost value from the NDC stack and return it.
      int push​(String context)
      Push a value on to the NDC stack, returning the new stack depth which should later be used to restore the stack.
      void trimTo​(int size)
      Trim the thread NDC stack down to no larger than the given size.
    • Method Detail

      • push

        int push​(String context)
        Push a value on to the NDC stack, returning the new stack depth which should later be used to restore the stack.
        Parameters:
        context - the new value
        Returns:
        the new stack depth
      • pop

        String pop()
        Pop the topmost value from the NDC stack and return it.
        Returns:
        the old topmost value
      • clear

        void clear()
        Clear the thread's NDC stack.
      • trimTo

        void trimTo​(int size)
        Trim the thread NDC stack down to no larger than the given size. Used to restore the stack to the depth returned by a push().
        Parameters:
        size - the new size
      • getDepth

        int getDepth()
        Get the current NDC stack depth.
        Returns:
        the stack depth
      • get

        String get()
        Get the current NDC value.
        Returns:
        the current NDC value, or "" if there is none
      • get

        String get​(int n)
        Provided for compatibility with log4j. Get the NDC value that is n entries from the bottom.
        Parameters:
        n - the index
        Returns:
        the value or null if there is none