- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ConsoleLogging,DevNullLogging,JULogging,Slf4jLogging,SystemLogging
Deprecated.
Accessor for
Logger instances. Configured once for a driver instance using Config.ConfigBuilder.withLogging(Logging) builder method.
Users are expected to either implement this interface or use one of the existing implementations (available via static methods in this interface):
SLF4J logging- uses available SLF4J binding (Logback, Log4j, etc.) fails when no SLF4J implementation is available. Uses application's logging configuration from XML or other type of configuration file. This logging method is the preferred one and relies on the SLF4J implementation available in the classpath or modulepath.Java Logging API (JUL)- usesLoggercreated viaLogger.getLogger(String). Global java util logging configuration applies. This logging method is suitable when application uses JUL for logging and explicitly configures it.Console logging- usesConsoleHandlerwith the specifiedlogging levelto print messages toSystem.err. This logging method is suitable for quick debugging or prototyping.No logging- implementation that discards all logged messages. This logging method is suitable for testing to make driver produce no output.
Driver logging API defines the following log levels: ERROR, INFO, WARN, DEBUG and TRACE. They are similar to levels defined by SLF4J but different from
log levels defined for java.util.logging. The following mapping takes place:
| Driver | java.util.logging |
|---|---|
| ERROR | SEVERE |
| INFO | INFO, CONFIG |
| WARN | WARNING |
| DEBUG | FINE, FINER |
| TRACE | FINEST |
Example of driver configuration with SLF4J logging:
Driver driver = GraphDatabase.driver("neo4j://localhost:7687",
AuthTokens.basic("neo4j", "password"),
Config.builder().withLogging(Logging.slf4j()).build());
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic LoggingDeprecated.Create logging implementation that usesjava.util.loggingto log toSystem.err.default LoggerDeprecated.Obtain aLoggerinstance by class, its name will be the fully qualified name of the class.Deprecated.Obtain aLoggerinstance by name.static LoggingjavaUtilLogging(Level level) Deprecated.Create logging implementation that usesjava.util.logging.static Loggingnone()Deprecated.Create logging implementation that discards all messages and logs nothing.static Loggingslf4j()Deprecated.Create logging implementation that uses SLF4J.static LoggingDeprecated.Returns logging implementation that usesSystem.Logger.
-
Method Details
-
getLog
Deprecated.Obtain aLoggerinstance by class, its name will be the fully qualified name of the class. -
getLog
Deprecated.Obtain aLoggerinstance by name. -
systemLogging
Deprecated.Returns logging implementation that usesSystem.Logger.- Returns:
- logging implementation
- Since:
- 6.0.0
-
slf4j
Deprecated.Create logging implementation that uses SLF4J.- Returns:
- new logging implementation.
- Throws:
IllegalStateException- if SLF4J is not available.
-
javaUtilLogging
Deprecated.Create logging implementation that usesjava.util.logging.- Parameters:
level- the log level.- Returns:
- new logging implementation.
-
console
Deprecated.Create logging implementation that usesjava.util.loggingto log toSystem.err.- Parameters:
level- the log level.- Returns:
- new logging implementation.
-
none
Deprecated.Create logging implementation that discards all messages and logs nothing.- Returns:
- new logging implementation.
-
System.Loggerthat the driver uses by default