### Berkeley DB Reference Guide: Upgrading Berkeley DB Applications |

# Release 4.0: log_XXX

The C API for the Berkeley DB Logging subsystem was reworked in the 4.0 release as follows:

Historic functional interface | Berkeley DB 4.X method
--- | ---
log_archive | DB_ENV->log_archive
log_file | DB_ENV->log_file
log_flush | DB_ENV->log_flush
log_get | DB_ENV->log_cursor, DB_LOGC->get, DB_LOGC->close
log_put | DB_ENV->log_put
log_register | DB_ENV->log_register
log_stat | DB_ENV->log_stat
log_unregister | DB_ENV->log_unregister

Applications calling any of these functions should update their calls to use the enclosing DB_ENV handle's method (in all cases other than the log_get call, this is easily done as the first argument to the existing call is the correct handle to use).

Application calls to the historic log_get interface must be replaced with the creation of a log file cursor (a DB_LOGC object), using the DB_ENV->log_cursor method, calls to the DB_LOGC->get method to retrieve log records and calls to the DB_LOGC->close method to destroy the cursor. It may also be possible to simplify some applications. In previous releases of Berkeley DB, the DB_CURRENT, DB_NEXT, and DB_PREV flags to the log_get function could not be used by a free-threaded DB_ENV handle. If their DB_ENV handle was free-threaded, applications had to create an additional, unique environment handle by separately calling DB_ENV->open without specifying DB_THREAD. This is no longer an issue in the log cursor interface, and applications may be able to remove the now unnecessary creation of the additional DB_ENV object.

Finally, the DB_ENV->log_stat call has been changed in the 4.0 release to take a flags argument. To leave their historic behavior unchanged, applications should add a final argument of 0 to any calls made to DB_ENV->log_stat.

Copyright Sleepycat Software