Package org.slf4j.impl
Class StaticLoggerBinder
- java.lang.Object
-
- org.slf4j.impl.StaticLoggerBinder
-
- All Implemented Interfaces:
org.slf4j.spi.LoggerFactoryBinder
public final class StaticLoggerBinder extends Object implements org.slf4j.spi.LoggerFactoryBinder
The binding ofILoggerFactory
class with an actual instance ofILoggerFactory
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 Summary
Fields Modifier and Type Field Description JcabiLoggers
loggers
TheILoggerFactory
instance returned by thegetLoggerFactory()
method should always be the same object.static String
REQUESTED_API_VERSION
Declare the version of the SLF4J API this implementation is compiled against.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.slf4j.ILoggerFactory
getLoggerFactory()
String
getLoggerFactoryClassStr()
org.apache.maven.plugin.logging.Log
getMavenLog()
Get Maven Log.static StaticLoggerBinder
getSingleton()
Return the singleton of this class.void
setMavenLog(org.apache.maven.plugin.logging.Log log)
Set Maven Log.
-
-
-
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
TheILoggerFactory
instance returned by thegetLoggerFactory()
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 interfaceorg.slf4j.spi.LoggerFactoryBinder
-
getLoggerFactoryClassStr
public String getLoggerFactoryClassStr()
- Specified by:
getLoggerFactoryClassStr
in interfaceorg.slf4j.spi.LoggerFactoryBinder
-
-