Class StormLogger

java.lang.Object
io.pzstorm.storm.logging.StormLogger

public class StormLogger extends Object

Wrapper class for printing Storm logs with Log4j 2 logger. To configure console logging level launch Storm with JVM_PROPERTY set to a custom logger level and call initialize() method.

Logs will automatically be printed to console and configured log files. Check log4j2.xml for log file locations. Use the static methods to print logs with desired log level. If you want to print with a log level not covered by static methods use get() method to get a reference to logger instance.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This handler will log an error with Log4J when a Thread abruptly terminates due to an uncaught exception.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.logging.log4j.Level
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    debug(String message)
    Logs a message object with the DEBUG level.
    static void
    debug(String format, Object... params)
    Logs a formatted message with DEBUG level using the specified format string and arguments.
    static void
    debug(String message, Throwable t)
    Logs a message at the DEBUG level including the stack trace of the Throwable t passed as parameter.
    static void
    Logs a message object with the VERBOSE level.
    static void
    detail(String format, Object... params)
    Logs a formatted message with VERBOSE level using the specified format string and arguments.
    static void
    error(String message)
    Logs a message object with the ERROR level.
    static void
    error(String format, Object... params)
    Logs a formatted message with ERROR level using the specified format string and arguments.
    static void
    error(String message, Throwable t)
    Logs a message at the ERROR level including the stack trace of the Throwable t passed as parameter.
    static org.apache.logging.log4j.Logger
    get()
    Returns an instance of Log4j Logger used for logging.
    static void
    info(String log)
    Logs a message object with the INFO level.
    static void
    info(String format, Object... params)
    Logs a formatted message with INFO level using the specified format string and arguments.
    static void
    Initialize StormLogger system by setting logging level resolved from system properties.
    static void
    printf(org.apache.logging.log4j.Level level, String format, Object... params)
    Logs a formatted message using the specified format string and arguments.
    static void
    warn(String message)
    Logs a message object with the WARN level.
    static void
    warn(String format, Object... params)
    Logs a formatted message with WARN level using the specified format string and arguments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VERBOSE

      public static final org.apache.logging.log4j.Level VERBOSE
  • Method Details

    • initialize

      public static void initialize()
      Initialize StormLogger system by setting logging level resolved from system properties. To configure console logging level launch Storm with JVM_PROPERTY set to a custom logger level.
    • get

      public static org.apache.logging.log4j.Logger get()
      Returns an instance of Log4j Logger used for logging.
    • info

      public static void info(String log)
      Logs a message object with the INFO level.
    • info

      public static void info(String format, Object... params)
      Logs a formatted message with INFO level using the specified format string and arguments.
      Parameters:
      format - the format String.
      params - arguments specified by the format.
    • detail

      public static void detail(String log)
      Logs a message object with the VERBOSE level.
    • detail

      public static void detail(String format, Object... params)
      Logs a formatted message with VERBOSE level using the specified format string and arguments.
      Parameters:
      format - the format String.
      params - arguments specified by the format.
    • error

      public static void error(String message)
      Logs a message object with the ERROR level.
      Parameters:
      message - the message string to log.
    • error

      public static void error(String format, Object... params)
      Logs a formatted message with ERROR level using the specified format string and arguments.
      Parameters:
      format - the format String.
      params - arguments specified by the format.
    • error

      public static void error(String message, Throwable t)
      Logs a message at the ERROR level including the stack trace of the Throwable t passed as parameter.
      Parameters:
      message - the message object to log.
      t - the exception to log, including its stack trace.
    • warn

      public static void warn(String message)
      Logs a message object with the WARN level.
      Parameters:
      message - the message string to log.
    • warn

      public static void warn(String format, Object... params)
      Logs a formatted message with WARN level using the specified format string and arguments.
      Parameters:
      format - the format String.
      params - arguments specified by the format.
    • debug

      public static void debug(String message)
      Logs a message object with the DEBUG level.
      Parameters:
      message - the message string to log.
    • debug

      public static void debug(String format, Object... params)
      Logs a formatted message with DEBUG level using the specified format string and arguments.
      Parameters:
      format - the format String.
      params - arguments specified by the format.
    • debug

      public static void debug(String message, Throwable t)
      Logs a message at the DEBUG level including the stack trace of the Throwable t passed as parameter.
      Parameters:
      message - the message to log.
      t - the exception to log, including its stack trace.
    • printf

      public static void printf(org.apache.logging.log4j.Level level, String format, Object... params)
      Logs a formatted message using the specified format string and arguments.
      Parameters:
      level - The logging Level.
      format - The format String.
      params - Arguments specified by the format.