Class SpiLoggerFactory
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.logging.SpiLoggerFactory
-
public final class SpiLoggerFactory extends java.lang.Object
Static factory for creating instances of the various spi loggers derived fromAbstractLogger
. In the most simple caseRepositoryService loggingService = SpiLoggerFactory.create(service);
creates a log wrapper forservice
which logs all calls to its methods if logging at the debug level is enabled. If logging is not enabled, no log wrapper is created at all andservice
itself is returned. There is thus virtually no overhead from disabled loggers. Loggers are enabled and disabled via the configuration mechanism of the logging framework which is in place.There are log wrappers for the following SPI entities:
RepositoryService loggingService = SpiLoggerFactory.create(service, logWriterProvider);
allows specification of aLogWriterProvider
. A LogWriterProvider provides theLogWriter
s for the individual SPI entities. If the LogWriter does not provide a LogWriter for a certain SPI entity no log wrapper is created for that entity. In the case ofSlf4jLogWriterProvider
, a LogWriter is only provided if the logger of the implementation class of the respective SPI entity is names after the class and has debug level enabled.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Batch
create(Batch batch, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenbatch
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forbatch
.static IdFactory
create(IdFactory idFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenidFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance foridFactory
.static NameFactory
create(NameFactory nameFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givennameFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance fornameFactory
.static PathFactory
create(PathFactory pathFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenpathFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forpathFactory
.static QValueFactory
create(QValueFactory qValueFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenqValueFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forqValueFactory
.static RepositoryService
create(RepositoryService service)
Shortcut forstatic RepositoryService
create(RepositoryService service, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenservice
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forservice
.static SessionInfo
create(SessionInfo sessionInfo, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givensessionInfo
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forsessionInfo
.
-
-
-
Method Detail
-
create
public static RepositoryService create(RepositoryService service)
Shortcut forcreate(service, new Slf4jLogWriterProvider());
- Parameters:
service
-- Returns:
- See Also:
create(RepositoryService, LogWriterProvider)
-
create
public static RepositoryService create(RepositoryService service, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenservice
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forservice
. Otherwise returnsservice
.- Parameters:
service
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
create
public static NameFactory create(NameFactory nameFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givennameFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance fornameFactory
. Otherwise returnsnameFactory
.- Parameters:
nameFactory
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
create
public static PathFactory create(PathFactory pathFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenpathFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forpathFactory
. Otherwise returnspathFactory
.- Parameters:
pathFactory
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
create
public static IdFactory create(IdFactory idFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenidFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance foridFactory
. Otherwise returnsidFactory
.- Parameters:
idFactory
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
create
public static QValueFactory create(QValueFactory qValueFactory, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenqValueFactory
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forqValueFactory
. Otherwise returnsqValueFactory
.- Parameters:
qValueFactory
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
create
public static SessionInfo create(SessionInfo sessionInfo, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givensessionInfo
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forsessionInfo
. Otherwise returnssessionInfo
.- Parameters:
sessionInfo
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
create
public static Batch create(Batch batch, LogWriterProvider logWriterProvider)
Returns a log wrapper for the givenbatch
which logs a calls to its methods iflogWriterProvider
returns aLogWriter
instance forbatch
. Otherwise returnsbatch
.- Parameters:
batch
-logWriterProvider
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if either argument isnull
-
-