Package ru.bgerp.util

Class Log


  • public class Log
    extends java.lang.Object
    Logging wrapper around Log4j version 1 with additional functions from version 2.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.Object message)
      Executes #log(Priority, String) with Level.DEBUG
      void debug​(java.lang.String pattern, java.lang.Object... params)
      Executes log(Priority, String, Object...) with Level.DEBUG
      void error​(java.lang.Object message)
      Executes #log(Priority, String) with Level.ERROR.
      void error​(java.lang.String pattern, java.lang.Object params)
      Executes log(Priority, String, Object...) with Level.ERROR.
      void error​(java.lang.String message, java.lang.Throwable e)
      Logs error message and stack trace.
      void error​(java.lang.Throwable e)
      Logs error message from e and stack trace.
      static java.lang.String format​(java.lang.String pattern, java.lang.Object... params)
      Universal formatter.
      static Log getLog()
      Using StackLocatorUtil gets the caller's object and logger for its class.
      static Log getLog​(java.lang.Class<?> clazz)
      Class connected logger.
      void info​(java.lang.Object message)
      Executes #log(Priority, String) with Level.INFO.
      void info​(java.lang.String pattern, java.lang.Object... params)
      Executes log(Priority, String, Object...) with Level.INFO.
      boolean isDebugEnabled()  
      void log​(org.apache.log4j.Priority level, java.lang.Object message)
      Wrapper function for Logger.
      void warn​(java.lang.Object message)
      Executes #log(Priority, String) with Level.WARN.
      void warn​(java.lang.String pattern, java.lang.Object... params)
      Executes log(Priority, String, Object...) with Level.WARN.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getLog

        public static Log getLog​(java.lang.Class<?> clazz)
        Class connected logger.
        Parameters:
        clazz - the class.
        Returns:
        logger configured for clazz
      • getLog

        public static Log getLog()
        Using StackLocatorUtil gets the caller's object and logger for its class.
        Returns:
        logger configured for the caller object's class.
      • debug

        public void debug​(java.lang.Object message)
        Executes #log(Priority, String) with Level.DEBUG
      • isDebugEnabled

        public boolean isDebugEnabled()
        Returns:
        is Level.DEBUG enabled.
      • info

        public void info​(java.lang.Object message)
        Executes #log(Priority, String) with Level.INFO.
      • warn

        public void warn​(java.lang.Object message)
        Executes #log(Priority, String) with Level.WARN.
      • error

        public void error​(java.lang.Object message)
        Executes #log(Priority, String) with Level.ERROR.
      • error

        public void error​(java.lang.Throwable e)
        Logs error message from e and stack trace.
        Parameters:
        e - exception.
      • error

        public void error​(java.lang.String message,
                          java.lang.Throwable e)
        Logs error message and stack trace.
        Parameters:
        message - message text.
        e - exception.
      • format

        public static java.lang.String format​(java.lang.String pattern,
                                              java.lang.Object... params)
        Universal formatter.
        Parameters:
        pattern - format using FormattedMessage, supports both &#123;&#125; and %s substitutions.
        params - parameters for replacements in pattern.
        Returns:
      • log

        public final void log​(org.apache.log4j.Priority level,
                              java.lang.Object message)
        Wrapper function for Logger.
        Parameters:
        level -
        message -