Class Logging


  • public class Logging
    extends java.lang.Object
    An front-end to SLF4J's LoggerFactory. It adds:
    • checks to current logger backend configuration (specifically if JUL is redirected correctly)
    • handles inner and anonymous classes correctly (use canonical name)
    • provides a parameterless factory method that uses the StackWalker introduced in Java 9 to determine the logger name
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void init()
      Does nothing as logging will be initialized whenever this class is loaded.
      static org.slf4j.Logger logger()
      Create a new logger for the caller class as of logger(Class).
      static org.slf4j.Logger logger​(java.lang.Class<?> type)
      Creates a new logger for the given class.
      static org.slf4j.Logger logger​(java.lang.String name)  
      static void shutdown()  
      • Methods inherited from class java.lang.Object

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

      • init

        public static void init()
        Does nothing as logging will be initialized whenever this class is loaded. It is strongly recommended to call this first in your main method to ensure just that.
      • shutdown

        public static void shutdown()
      • logger

        public static org.slf4j.Logger logger()
        Create a new logger for the caller class as of logger(Class).
      • logger

        public static org.slf4j.Logger logger​(java.lang.Class<?> type)
        Creates a new logger for the given class. If the caller class is an anonymous or local inner class, this method searches the innermost enclosing non-anonymous class. If the class is an array, the component type will be used.
      • logger

        public static org.slf4j.Logger logger​(java.lang.String name)