Class SpiLoggerFactory
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.logging.SpiLoggerFactory
-
public final class SpiLoggerFactory extends 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 forservicewhich 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 andserviceitself 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 theLogWriters 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 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 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 givenservicewhich logs a calls to its methods iflogWriterProviderreturns aLogWriterinstance forservice. Otherwise returnsservice.- Parameters:
service-logWriterProvider-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
create
public static NameFactory create(NameFactory nameFactory, LogWriterProvider logWriterProvider)
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
public static PathFactory create(PathFactory pathFactory, LogWriterProvider logWriterProvider)
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
public static IdFactory create(IdFactory idFactory, LogWriterProvider logWriterProvider)
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
public static SessionInfo create(SessionInfo sessionInfo, LogWriterProvider logWriterProvider)
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
public static Batch create(Batch batch, LogWriterProvider logWriterProvider)
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
-
-