Class RuntimeLoggerSingleton

  • All Implemented Interfaces:
    LogPriorityAccessor, MessageLogger<LogPriority>, RuntimeLogger, org.refcodes.mixin.NameAccessor

    public class RuntimeLoggerSingleton
    extends java.lang.Object
    implements RuntimeLogger
    This RuntimeLoggerSingleton provides a RuntimeLogger singleton configured by a "runtimelogger-config.xml" file find in one of the several locations relative to your application's base directory: The applications base directory (where your JAR or your classes reside) is taken and a list of directories (as defined in the Folders.CONFIG_DIRS) relative to this base directory is generated : The actual directories being looked at (in case them exist) are as follows, relative to your applications base directory:
    • ../config"
    • ../etc"
    • ../settings"
    • ../.config"
    • ../settings"
    • ."
    • ./config"
    • ./etc"
    • ./settings"
    • ./.config"
    • ./settings"
    In case you pass a JVM argument via "-Dconfig.dir=path_to_your_config_dir" (where path_to_your_config_dir stands for the path to the directory where you placed configuration files such as the "runtimelogger-config.xml"" file), then your path_to_your_config_dir is placed first in the list of configuration directories to look at (in case the directory exists).See SystemProperty.CONFIG_DIR
    • Constructor Detail

      • RuntimeLoggerSingleton

        protected RuntimeLoggerSingleton​(RuntimeLogger aRuntimeLogger)
        Instantiates a new runtime logger singleton.
        Parameters:
        aRuntimeLogger - the runtime logger
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface org.refcodes.mixin.NameAccessor
      • log

        public void log​(LogPriority aMarker,
                        java.lang.String aMessage)
        Creates a new log message.
        Specified by:
        log in interface MessageLogger<LogPriority>
        Parameters:
        aMarker - The marker for the message.
        aMessage - The message to be logged.
      • log

        public void log​(LogPriority aPriority,
                        java.lang.String aMessage,
                        java.lang.Throwable aThrowable)
        Creates a new log message.
        Specified by:
        log in interface RuntimeLogger
        Parameters:
        aPriority - The level of the message.
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
      • log

        public void log​(LogPriority aMarker,
                        java.lang.String aMessage,
                        java.lang.Object... aArguments)
        Creates a new log message. The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y.
        Specified by:
        log in interface MessageLogger<LogPriority>
        Parameters:
        aMarker - The marker for the message.
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • log

        public void log​(LogPriority aPriority,
                        java.lang.String aMessage,
                        java.lang.Throwable aThrowable,
                        java.lang.Object... aArguments)
        Creates a new log message. The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y.
        Specified by:
        log in interface RuntimeLogger
        Parameters:
        aPriority - The level of the message.
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
        aArguments - The arguments used when replacing the placeholders.
      • trace

        public void trace​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.TRACE.
        Specified by:
        trace in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • trace

        public void trace​(java.lang.String aMessage,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.TRACE. The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y.
        Specified by:
        trace in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • isLogTrace

        public boolean isLogTrace()
        Determines whether the RuntimeLogger is being configured to log comments (LogPriority.TRACE). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogTrace in interface RuntimeLogger
        Returns:
        True in case comments are logged.
      • debug

        public void debug​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.DEBUG. "Info useful to developers for debugging the application, not useful during operations." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        debug in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • debug

        public void debug​(java.lang.String aMessage,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.DEBUG. "Info useful to developers for debugging the application, not useful during operations." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        debug in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • isLogDebug

        public boolean isLogDebug()
        Determines whether the RuntimeLogger is being configured to log debug messages (LogPriority.DEBUG). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogDebug in interface RuntimeLogger
        Returns:
        True in case debug messages are logged.
      • info

        public void info​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.INFO. "Additional information which might be useful for some stability period." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        info in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • info

        public void info​(java.lang.String aMessage,
                         java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.INFO. "Additional information which might be useful for some stability period." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        info in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • isLogInfo

        public boolean isLogInfo()
        Determines whether the RuntimeLogger is being configured to log infos (LogPriority.INFO). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogInfo in interface RuntimeLogger
        Returns:
        True in case infos are logged.
      • notice

        public void notice​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.NOTICE. "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        notice in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • notice

        public void notice​(java.lang.String aMessage,
                           java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.NOTICE. "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        notice in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • isLogNotice

        public boolean isLogNotice()
        Determines whether the RuntimeLogger is being configured to log notices (LogPriority.NOTICE). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogNotice in interface RuntimeLogger
        Returns:
        True in case infos are logged.
      • warn

        public void warn​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        warn in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • warn

        public void warn​(java.lang.String aMessage,
                         java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        warn in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • warn

        public void warn​(java.lang.String aMessage,
                         java.lang.Throwable aThrowable)
        Logs a log message with log priority LogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        warn in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
      • warn

        public void warn​(java.lang.String aMessage,
                         java.lang.Throwable aThrowable,
                         java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        warn in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
        aArguments - The arguments used when replacing the placeholders.
      • isLogWarn

        public boolean isLogWarn()
        Determines whether the RuntimeLogger is being configured to log warnings (LogPriority.WARN). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogWarn in interface RuntimeLogger
        Returns:
        True in case warnings are logged.
      • error

        public void error​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        error in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • error

        public void error​(java.lang.String aMessage,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        error in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • error

        public void error​(java.lang.String aMessage,
                          java.lang.Throwable aThrowable)
        Logs a log message with log priority LogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        error in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
      • error

        public void error​(java.lang.String aMessage,
                          java.lang.Throwable aThrowable,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        error in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
        aArguments - The arguments used when replacing the placeholders.
      • isLogError

        public boolean isLogError()
        Determines whether the RuntimeLogger is being configured to log errors (LogPriority.ERROR). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogError in interface RuntimeLogger
        Returns:
        True in case errors are logged.
      • critical

        public void critical​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        critical in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • critical

        public void critical​(java.lang.String aMessage,
                             java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        critical in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • critical

        public void critical​(java.lang.String aMessage,
                             java.lang.Throwable aThrowable)
        Logs a log message with log priority LogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        critical in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
      • critical

        public void critical​(java.lang.String aMessage,
                             java.lang.Throwable aThrowable,
                             java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        critical in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
        aArguments - The arguments used when replacing the placeholders.
      • isLogCritical

        public boolean isLogCritical()
        Determines whether the RuntimeLogger is being configured to log fatal messages (LogPriority.CRITICAL). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogCritical in interface RuntimeLogger
        Returns:
        True in case fatal messages are logged.
      • alert

        public void alert​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.ALERT. "Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection." See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        alert in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • alert

        public void alert​(java.lang.String aMessage,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.ALERT. "Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        alert in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • alert

        public void alert​(java.lang.String aMessage,
                          java.lang.Throwable aThrowable)
        Logs a log message with log priority LogPriority.ALERT.
        Specified by:
        alert in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
      • alert

        public void alert​(java.lang.String aMessage,
                          java.lang.Throwable aThrowable,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.ALERT.
        Specified by:
        alert in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
        aArguments - The arguments used when replacing the placeholders.
      • isLogAlert

        public boolean isLogAlert()
        Determines whether the RuntimeLogger is being configured to log fatal messages (LogPriority.ALERT). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogAlert in interface RuntimeLogger
        Returns:
        True in case fatal messages are logged.
      • panic

        public void panic​(java.lang.String aMessage)
        Logs a log message with log priority LogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." ( See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        panic in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
      • panic

        public void panic​(java.lang.String aMessage,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        panic in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aArguments - The arguments used when replacing the placeholders.
      • panic

        public void panic​(java.lang.String aMessage,
                          java.lang.Throwable aThrowable)
        Logs a log message with log priority LogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." ( See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        panic in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
      • panic

        public void panic​(java.lang.String aMessage,
                          java.lang.Throwable aThrowable,
                          java.lang.Object... aArguments)
        Logs a log message with log priority LogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." The placeholders in the message String are being replaced by the provided arguments. Implementations of this interface are recommended to use Java's MessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog
        Specified by:
        panic in interface RuntimeLogger
        Parameters:
        aMessage - The message to be logged.
        aThrowable - An exception that the message should contain.
        aArguments - The arguments used when replacing the placeholders.
      • isLogPanic

        public boolean isLogPanic()
        Determines whether the RuntimeLogger is being configured to log fatal messages (LogPriority.PANIC). This method is useful to prevent the generation of vast amounts of log message String objects (and according processing) for the according LogPriority in case them messages of that LogPriority are not logged at all.
        Specified by:
        isLogPanic in interface RuntimeLogger
        Returns:
        True in case fatal messages are logged.