Difference between revisions of "Logging JDBC Activity"
From Apache OpenOffice Wiki
DrewJensen (talk | contribs) |
|||
| (10 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Logging]] | [[Category:Logging]] | ||
| − | [[Base]]'s JDBC bridge - the database driver to access database with an JDBC compliant driver - allows to log its activity. For this, the driver uses a logger named "org.openoffice.sdbc.jdbcBridge" | + | [[Base]]'s JDBC bridge - the database driver to access database with an JDBC compliant driver - allows to log its activity. For this, the driver uses a [http://wiki.services.openoffice.org/wiki/Category:Logging logger] named "<code>org.openoffice.sdbc.jdbcBridge</code>". |
| + | |||
| + | == Quick start == | ||
| + | Say you want to see erros which happen in an JDBC driver. With the Basic macros found in [http://wiki.services.openoffice.org/wiki/Category:Logging the overview article], this boils down to | ||
| + | * execute | ||
| + | <source lang="oobas"> | ||
| + | setLogLevel( "org.openoffice.sdbc.jdbcBridge", com.sun.star.logging.LogLevel.SEVERE ) | ||
| + | </source> | ||
| + | (See the [http://wiki.services.openoffice.org/wiki/Category:Logging overview] for how to tweak more parameters of the logger.) | ||
| + | * (maybe restart OpenOffice.org) | ||
| + | * do whatever needs to be logged | ||
| + | * look into the log file, which is <code>$(userurl)/org.openoffice.sdbc.jdbcBridge.log</code> | ||
| + | |||
| + | == Logged Events == | ||
| + | |||
| + | Below are lists of which events are logged at which log level. Note that if you [http://wiki.services.openoffice.org/wiki/Category:Logging#Enabling_a_logger_.2F_Setting_a_LogLevel enable logging for a certain level], then all events of this level <em>and above</em> are logged. Below, the levels are in decreasing order. | ||
| + | |||
| + | === LogLevel.SEVERE === | ||
| + | * a driver class which has not been set up correctly | ||
| + | * a failure in obtaining the JDBC connection which is to be bridged | ||
| + | * most (if not all) exceptions thrown by the JDBC driver | ||
| + | |||
| + | === LogLevel.WARNING === | ||
| + | No events are logged at this level. | ||
| + | |||
| + | === LogLevel.INFO === | ||
| + | * connecting to a database, and shutting down of connections | ||
| + | * successful retrieving of a system JDBC connection (note: up to OpenOffice.org 2.3.x, this was at ''LogLevel::FINE'') | ||
| + | |||
| + | === LogLevel.CONFIG === | ||
| + | No events are logged at this level. | ||
| + | |||
| + | === LogLevel.FINE === | ||
| + | * statement related connection activity, such as creation and preparation of statements and calls | ||
| + | * execution and disposal of [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/Statement.html statements] (note: up to OpenOffice.org 2.3.x, this was at ''LogLevel::INFO'') | ||
| + | * [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/XStatement.html#executeQuery executeQuery] and [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/XStatement.html#executeUpdate executeUpdate] calls (note: up to OpenOffice.org 2.3.x, this was at ''LogLevel::INFO'') | ||
| + | * setting the [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/Statement.html#EscapeProcessing escape processing] of a statement (note: up to OpenOffice.org 2.3.x, this was at ''LogLevel::INFO'') | ||
| + | |||
| + | === LogLevel.FINER === | ||
| + | |||
| + | * setting certain statement attributes such as fetch direction and fetch size | ||
| + | * setting parameters of a [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/PreparedStatement.html prepared statement] | ||
| + | * translating SQL statements to native SQL | ||
| + | * the [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/XMultipleResults.html#getUpdateCount update count] of statements | ||
| + | * the [http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/JDBCConnectionProperties.html#SystemSettings properties forwarded to the] <code>java.lang.System.setProperty</code> before loading the system's JDBC driver (note: this is new with OpenOffice.org 2.3.1 resp. 2.4) | ||
| + | |||
| + | === LogLevel.FINEST === | ||
| + | * meta data activitiy, such as asking for database properties and settings | ||
Latest revision as of 07:14, 2 July 2008
Base's JDBC bridge - the database driver to access database with an JDBC compliant driver - allows to log its activity. For this, the driver uses a logger named "org.openoffice.sdbc.jdbcBridge".
Quick start
Say you want to see erros which happen in an JDBC driver. With the Basic macros found in the overview article, this boils down to
- execute
setLogLevel( "org.openoffice.sdbc.jdbcBridge", com.sun.star.logging.LogLevel.SEVERE )
(See the overview for how to tweak more parameters of the logger.)
- (maybe restart OpenOffice.org)
- do whatever needs to be logged
- look into the log file, which is
$(userurl)/org.openoffice.sdbc.jdbcBridge.log
Logged Events
Below are lists of which events are logged at which log level. Note that if you enable logging for a certain level, then all events of this level and above are logged. Below, the levels are in decreasing order.
LogLevel.SEVERE
- a driver class which has not been set up correctly
- a failure in obtaining the JDBC connection which is to be bridged
- most (if not all) exceptions thrown by the JDBC driver
LogLevel.WARNING
No events are logged at this level.
LogLevel.INFO
- connecting to a database, and shutting down of connections
- successful retrieving of a system JDBC connection (note: up to OpenOffice.org 2.3.x, this was at LogLevel::FINE)
LogLevel.CONFIG
No events are logged at this level.
LogLevel.FINE
- statement related connection activity, such as creation and preparation of statements and calls
- execution and disposal of statements (note: up to OpenOffice.org 2.3.x, this was at LogLevel::INFO)
- executeQuery and executeUpdate calls (note: up to OpenOffice.org 2.3.x, this was at LogLevel::INFO)
- setting the escape processing of a statement (note: up to OpenOffice.org 2.3.x, this was at LogLevel::INFO)
LogLevel.FINER
- setting certain statement attributes such as fetch direction and fetch size
- setting parameters of a prepared statement
- translating SQL statements to native SQL
- the update count of statements
- the properties forwarded to the
java.lang.System.setPropertybefore loading the system's JDBC driver (note: this is new with OpenOffice.org 2.3.1 resp. 2.4)
LogLevel.FINEST
- meta data activitiy, such as asking for database properties and settings