Skip to content

Logging

Mark Rotteveel edited this page Jul 19, 2015 · 1 revision

information outdated

Q: Does Jaybird provide logging?

A: Yes. Jaybird is able to use log4j to log what’s actually happening. In order to enable logging you have to add log4j classes to the classpath and to specify FBLog4j=true JVM system property. Also you have to ensure that your log4j is correctly configured. You must have a log4j.properties file in your classpath. Note, log4j shipped with Jaybird distribution includes only file appender.

Sample configurations:

  • using standard out for logging all debug levels (requires full log4j distribution):
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%c{1},%p] %m%n

log4j.rootCategory=DEBUG, stdout
log4j.category.org.firebirdsql=DEBUG, stdout
  • using a file test.log for logging all WARN, ERROR and FATAL levels for Jaybird and all levels for other code (runs with log4j-core.jar):
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=test.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%c{1},%p] %m%n
log4j.appender.file.Append=true

log4j.rootCategory=DEBUG, stdout
log4j.category.org.firebirdsql=WARN, stdout

Following things are logged:

DEBUG level

  • XdrOutputStream and GDS_Impl : remote protocol debug stuff including java.io.IOException when attaching database and exceptions that happen during initialization of client library.
  • FBManagedConnection and FBManagedConnectionFactory : JCA debug stuff including logging most of the exceptions.

INFO level

  • GDSExceptionHelper : when messages file cannot be loaded.
  • GDS_Impl : information about loading client libraries.
  • AbstractConnectionPool : when pool is shutted down.
  • PooledConnectionQueue : when connection is obtained from pool.

WARN level

  • GDS_Impl : when java.io.IOException happened during receiveing response.
  • FBManagedConnection : when rollback is called on unknown transaction or prepare did not succeed.
  • FBManagedConnectionFactory : when specified blob buffer size is smaller or greater than allowed.
  • FBDatabaseMetaData : when error happened during closing this object (in theory cannot happen).
  • AbstractConnectionPool :
  • when connection did not succeed “ping” and was droped;
  • when connection was returned to the pool but it does not belong to any known queue (this would be serious bug in connection pool and causes IllegalStateException? to be thrown);
  • when error happened during returning the connection back to the pool.
  • PooledConnectionQueue : when queue is blocked and unblocked due to a heavy load, error happened during queue shutdown, or thread was interrupted during returning connection back to the pool.
  • PingablePooledConnection : when physical connection was not correctly closed.
  • XPreparedStatementCache : when thread was interrupted during returning statement back to the pool.

ERROR level

  • PingablePooledConnection : when cached prepared statement is returned to the pool and the pool is not found (in this case we simply close the statement and release the resource, but this is an error in the pool).
  • FBDriver : when driver could not be registered at java.sql.DriverManager.
  • GDS_Impl : when specified host could not be resolved during attaching to the database or security manager prevented driver from loading a client library.

FATAL level

None.