Class StaticLoggerBinder

  • All Implemented Interfaces:
    org.slf4j.spi.LoggerFactoryBinder

    public final class StaticLoggerBinder
    extends Object
    implements org.slf4j.spi.LoggerFactoryBinder
    The binding of ILoggerFactory class with an actual instance of ILoggerFactory is performed using information returned by this class.

    This is what you should do in your Maven plugin (before everything else):

     import org.apache.maven.plugin.AbstractMojo;
     import org.slf4j.impl.StaticLoggerBinder;
     public class MyMojo extends AbstractMojo {
       @Override
       public void execute() {
         StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
         // ... all the rest
       }
     }

    All SLF4J calls will be forwarded to Maven Log.

    The class is thread-safe.

    Since:
    0.1.6
    See Also:
    SLF4J FAQ
    • Field Detail

      • REQUESTED_API_VERSION

        public static final String REQUESTED_API_VERSION
        Declare the version of the SLF4J API this implementation is compiled against. The value of this field is usually modified with each release.
        See Also:
        Constant Field Values
      • loggers

        public final transient JcabiLoggers loggers
        The ILoggerFactory instance returned by the getLoggerFactory() method should always be the same object.
    • Method Detail

      • getSingleton

        public static StaticLoggerBinder getSingleton()
        Return the singleton of this class.
        Returns:
        The StaticLoggerBinder singleton
      • setMavenLog

        public void setMavenLog​(org.apache.maven.plugin.logging.Log log)
        Set Maven Log.
        Parameters:
        log - The log from Maven plugin
      • getMavenLog

        public org.apache.maven.plugin.logging.Log getMavenLog()
        Get Maven Log.
        Returns:
        The log
      • getLoggerFactory

        public org.slf4j.ILoggerFactory getLoggerFactory()
        Specified by:
        getLoggerFactory in interface org.slf4j.spi.LoggerFactoryBinder
      • getLoggerFactoryClassStr

        public String getLoggerFactoryClassStr()
        Specified by:
        getLoggerFactoryClassStr in interface org.slf4j.spi.LoggerFactoryBinder