Class Logging


  • public class Logging
    extends Object
    Utility class to close the current logger
    Author:
    gman6028
    • Constructor Detail

      • Logging

        public Logging()
    • Method Detail

      • closeLogger

        public static void closeLogger​(Logger logger)
        Close the current logger
        Parameters:
        logger - the logger to be closed
      • createLogger

        public static Logger createLogger​(Class<?> clazz)
                                   throws Exception
        Create logger using configuration. If no configuration exists, it is attempted to be reader from the available resources. If it does not exist, null is returned. Otherwise the logger is returned based on the configuration. Use this to inialise a PLANit application with a particular logging configuration and the ability to verify this has worked using the default configuration properties by checking for null
        Parameters:
        clazz - class for which the logger is being created
        Returns:
        the logger for this class
        Throws:
        Exception - thrown if log file cannot be opened
      • createLogger

        public static Optional<Logger> createLogger​(Class<?> clazz,
                                                    String loggingFileName)
                                             throws Exception
        Create logger This method is unlikely to be used directly since the value of logFileSystemProperty should never be changed from its default.
        Parameters:
        clazz - class for which the logger is being created
        loggingFileName - name of logging properties file
        Returns:
        the logger for this class, null if not able to configure based on properties file
        Throws:
        Exception - thrown if log file cannot be opened