Class SpiLoggerFactory
java.lang.Object
org.apache.jackrabbit.spi.commons.logging.SpiLoggerFactory
Static factory for creating instances of the various spi loggers derived from
AbstractLogger.
In the most simple case
RepositoryService loggingService = SpiLoggerFactory.create(service);creates a log wrapper for
service 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 and service 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 a
LogWriterProvider. A LogWriterProvider provides the
LogWriters 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
of Slf4jLogWriterProvider, 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
Modifier and TypeMethodDescriptionstatic Batchcreate(Batch batch, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenbatchwhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forbatch.static IdFactorycreate(IdFactory idFactory, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenidFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance foridFactory.static NameFactorycreate(NameFactory nameFactory, LogWriterProvider logWriterProvider) Returns a log wrapper for the givennameFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance fornameFactory.static PathFactorycreate(PathFactory pathFactory, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenpathFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forpathFactory.static QValueFactorycreate(QValueFactory qValueFactory, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenqValueFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forqValueFactory.static RepositoryServicecreate(RepositoryService service) Shortcut forstatic RepositoryServicecreate(RepositoryService service, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenservicewhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forservice.static SessionInfocreate(SessionInfo sessionInfo, LogWriterProvider logWriterProvider) Returns a log wrapper for the givensessionInfowhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forsessionInfo.
-
Method Details
-
create
Shortcut forcreate(service, new Slf4jLogWriterProvider());
- Parameters:
service-- Returns:
- See Also:
-
create
public static RepositoryService create(RepositoryService service, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenservicewhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forservice. Otherwise returnsservice.- Parameters:
service-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
Returns a log wrapper for the givennameFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance fornameFactory. Otherwise returnsnameFactory.- Parameters:
nameFactory-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
Returns a log wrapper for the givenpathFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forpathFactory. Otherwise returnspathFactory.- Parameters:
pathFactory-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
Returns a log wrapper for the givenidFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance foridFactory. Otherwise returnsidFactory.- Parameters:
idFactory-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
public static QValueFactory create(QValueFactory qValueFactory, LogWriterProvider logWriterProvider) Returns a log wrapper for the givenqValueFactorywhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forqValueFactory. Otherwise returnsqValueFactory.- Parameters:
qValueFactory-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
Returns a log wrapper for the givensessionInfowhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forsessionInfo. Otherwise returnssessionInfo.- Parameters:
sessionInfo-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
Returns a log wrapper for the givenbatchwhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forbatch. Otherwise returnsbatch.- Parameters:
batch-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-