Interface Logger


  • public interface Logger
    The Java agent's logging interface. Use this interface to create entries in the Agent's log. By default, the Agent's log is written to the file newrelic_agent.log in the logs/ subdirectory at the Agent's install location.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean isLoggable​(java.util.logging.Level level)
      Returns true if the given log level will be logged.
      void log​(java.util.logging.Level level, java.lang.String pattern)
      Concatenate the given parts and log them at the given level.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1)
      Log a message at the given level using the provided pattern with one replacement.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object[] msg)
      Do not use.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2)
      Log a message at the given level using the provided pattern with two replacements.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3)
      Log a message at the given level using the provided pattern with three replacements.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4)
      Log a message at the given level using the provided pattern with four replacements.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5)
      Log a message at the given level using the provided pattern with five replacements.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5, java.lang.Object part6)
      Log a message at the given level using the provided pattern with six replacements.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5, java.lang.Object part6, java.lang.Object part7)
      Log a message at the given level using the provided pattern with seven replacements.
      void log​(java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5, java.lang.Object part6, java.lang.Object part7, java.lang.Object... otherParts)
      Log a message at the given level using the provided pattern with seven + any other replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern)
      Log a message with given Throwable information.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1)
      Log a message at the given level using the provided pattern and throwable with one replacement.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object[] msg)
      Do not use.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2)
      Log a message at the given level using the provided pattern and throwable with two replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3)
      Log a message at the given level using the provided pattern and throwable with three replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4)
      Log a message at the given level using the provided pattern and throwable with four replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5)
      Log a message at the given level using the provided pattern and throwable with five replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5, java.lang.Object part6)
      Log a message at the given level using the provided pattern and throwable with six replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5, java.lang.Object part6, java.lang.Object part7)
      Log a message at the given level using the provided pattern and throwable with seven replacements.
      void log​(java.util.logging.Level level, java.lang.Throwable t, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4, java.lang.Object part5, java.lang.Object part6, java.lang.Object part7, java.lang.Object... otherParts)
      Log a message at the given level using the provided pattern and throwable with seven + any other replacements.
      void logToChild​(java.lang.String childName, java.util.logging.Level level, java.lang.String pattern, java.lang.Object part1, java.lang.Object part2, java.lang.Object part3, java.lang.Object part4)
      Concatenate the given parts and log them at the given level.
    • Method Detail

      • isLoggable

        boolean isLoggable​(java.util.logging.Level level)
        Returns true if the given log level will be logged. Generally this method should NOT be used - just call the log(Level, String, Object...) methods with the message broken into parts. The overhead of the concatenation will not be incurred if the log level isn't met.
        Parameters:
        level - The level to be verified.
        Returns:
        True if a message could be logged at the given level, else false.
        Since:
        3.9.0
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object[] msg)
        Do not use. This exists only for legacy reasons.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        msg - The parts to be placed in the log message using the MessageFormat style.
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern)
        Concatenate the given parts and log them at the given level. If a part is null, its value will be represented as "null". If a part is a Class, the value of Class.getName() will be used.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        Since:
        3.9.0
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1)
        Log a message at the given level using the provided pattern with one replacement.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2)
        Log a message at the given level using the provided pattern with two replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3)
        Log a message at the given level using the provided pattern with three replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4)
        Log a message at the given level using the provided pattern with four replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5)
        Log a message at the given level using the provided pattern with five replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5,
                 java.lang.Object part6)
        Log a message at the given level using the provided pattern with six replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
        part6 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5,
                 java.lang.Object part6,
                 java.lang.Object part7)
        Log a message at the given level using the provided pattern with seven replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
        part6 - The part to be replaced in the log message using the MessageFormat style
        part7 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5,
                 java.lang.Object part6,
                 java.lang.Object part7,
                 java.lang.Object... otherParts)
        Log a message at the given level using the provided pattern with seven + any other replacements.
        Parameters:
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
        part6 - The part to be replaced in the log message using the MessageFormat style
        part7 - The part to be replaced in the log message using the MessageFormat style
        otherParts - The other parts to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object[] msg)
        Do not use. This exists only for legacy reasons.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        msg - The parts to be placed in the log message using the MessageFormat style.
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern)
        Log a message with given Throwable information. Concatenate the given msg and log them at the given level. If a msg is null, its value will be represented as "null". If a part is a Class, the value of Class.getName() will be used.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        Since:
        3.9.0
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1)
        Log a message at the given level using the provided pattern and throwable with one replacement.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2)
        Log a message at the given level using the provided pattern and throwable with two replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3)
        Log a message at the given level using the provided pattern and throwable with three replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4)
        Log a message at the given level using the provided pattern and throwable with four replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5)
        Log a message at the given level using the provided pattern and throwable with five replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5,
                 java.lang.Object part6)
        Log a message at the given level using the provided pattern and throwable with six replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
        part6 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5,
                 java.lang.Object part6,
                 java.lang.Object part7)
        Log a message at the given level using the provided pattern and throwable with seven replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
        part6 - The part to be replaced in the log message using the MessageFormat style
        part7 - The part to be replaced in the log message using the MessageFormat style
      • log

        void log​(java.util.logging.Level level,
                 java.lang.Throwable t,
                 java.lang.String pattern,
                 java.lang.Object part1,
                 java.lang.Object part2,
                 java.lang.Object part3,
                 java.lang.Object part4,
                 java.lang.Object part5,
                 java.lang.Object part6,
                 java.lang.Object part7,
                 java.lang.Object... otherParts)
        Log a message at the given level using the provided pattern and throwable with seven + any other replacements.
        Parameters:
        level - The level at which the message should be logged.
        t - The exception to be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        part5 - The part to be replaced in the log message using the MessageFormat style
        part6 - The part to be replaced in the log message using the MessageFormat style
        part7 - The part to be replaced in the log message using the MessageFormat style
        otherParts - The other parts to be replaced in the log message using the MessageFormat style
      • logToChild

        void logToChild​(java.lang.String childName,
                        java.util.logging.Level level,
                        java.lang.String pattern,
                        java.lang.Object part1,
                        java.lang.Object part2,
                        java.lang.Object part3,
                        java.lang.Object part4)
        Concatenate the given parts and log them at the given level. If a part is null, its value will be represented as "null". If a part is a Class, the value of Class.getName() will be used.
        Parameters:
        childName - The name of the child logger.
        level - The level at which the message should be logged.
        pattern - A message format pattern in the MessageFormat style.
        part1 - The part to be replaced in the log message using the MessageFormat style
        part2 - The part to be replaced in the log message using the MessageFormat style
        part3 - The part to be replaced in the log message using the MessageFormat style
        part4 - The part to be replaced in the log message using the MessageFormat style
        Since:
        3.9.0