Class JavaLogger

  • All Implemented Interfaces:
    ILogger

    public class JavaLogger
    extends AbstractJavaLogger
    This class is the ILogger implementation for java.util.logging.Logger.
    Author:
    Sass
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaLogger()
      Constructor to initialize the instance of the logger.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.String msg, java.lang.Class<?> clazz, java.lang.String bundleName)
      Log an DEBUG message.
      void error​(java.lang.String msg, java.lang.Class<?> clazz, java.lang.String bundleName)
      Log an ERROR message.
      void exception​(java.lang.String msg, java.lang.Class<?> clazz, java.lang.String bundleName)
      Log an EXCEPTION message.
      void info​(java.lang.String msg, java.lang.Class<?> clazz, java.lang.String bundleName)
      Log an INFO message.
      void setFilter​(java.util.logging.Filter filter)
      Each Logger and each Handler can have a filter associated with it.
      void warn​(java.lang.String msg, java.lang.Class<?> clazz, java.lang.String bundleName)
      Log an WARN message.
      • Methods inherited from class java.lang.Object

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

      • JavaLogger

        public JavaLogger()
        Constructor to initialize the instance of the logger. To change the output format modify the LogFormatter class. By default the logging level is set to ALL. In a productive environment the level should be set to INFO. Use the setLogLevel method to change the level.
    • Method Detail

      • info

        public void info​(java.lang.String msg,
                         java.lang.Class<?> clazz,
                         java.lang.String bundleName)
        Description copied from interface: ILogger
        Log an INFO message.

        If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.

        Parameters:
        msg - The string message (or a key in the message catalog)
        clazz - The class where the message was created
        bundleName - Name of the bundle where the message was created
      • error

        public void error​(java.lang.String msg,
                          java.lang.Class<?> clazz,
                          java.lang.String bundleName)
        Description copied from interface: ILogger
        Log an ERROR message.

        If the logger is currently enabled for the ERROR message level then the given message is forwarded to all the registered output Handler objects.

        Parameters:
        msg - The string message (or a key in the message catalog)
        clazz - The class where the message was created
        bundleName - Name of the bundle where the message was created
      • warn

        public void warn​(java.lang.String msg,
                         java.lang.Class<?> clazz,
                         java.lang.String bundleName)
        Description copied from interface: ILogger
        Log an WARN message.

        If the logger is currently enabled for the WARN message level then the given message is forwarded to all the registered output Handler objects.

        Parameters:
        msg - The string message (or a key in the message catalog)
        clazz - The class where the message was created
        bundleName - Name of the bundle where the message was created
      • debug

        public void debug​(java.lang.String msg,
                          java.lang.Class<?> clazz,
                          java.lang.String bundleName)
        Description copied from interface: ILogger
        Log an DEBUG message.

        If the logger is currently enabled for the DEBUG message level then the given message is forwarded to all the registered output Handler objects.

        Parameters:
        msg - The string message (or a key in the message catalog)
        clazz - The class where the message was created
        bundleName - Name of the bundle where the message was created
      • exception

        public void exception​(java.lang.String msg,
                              java.lang.Class<?> clazz,
                              java.lang.String bundleName)
        Description copied from interface: ILogger
        Log an EXCEPTION message.

        If the logger is currently enabled for the EXCEPTION message level then the given message is forwarded to all the registered output Handler objects.

        Parameters:
        msg - The string message (or a key in the message catalog)
        clazz - The class where the message was created
        bundleName - Name of the bundle where the message was created
      • setFilter

        public void setFilter​(java.util.logging.Filter filter)
        Each Logger and each Handler can have a filter associated with it. The Logger or Handler will call the isLoggable method to check if a given LogRecord should be published. If isLoggable returns false, the LogRecord will be discarded. This method should only be used for jUnit testing since it suppresses logging.
        Parameters:
        filter - The Filter that should be used. May be null.