DbEnv::log_printf()
Prev | Chapter 8. The DbLsn Handle | Next

## DbEnv::log_printf()

    #include <db_cxx.h>

    int
    DbEnv::log_printf(DB_TXN *txnid, const char *fmt, ...);

The `DbEnv::log_printf()` method appends an informational message to the Berkeley DB database environment log files.

The `DbEnv::log_printf()` method allows applications to include information in the database environment log files, for later review using the db_printlog utility. This method is intended for debugging and performance tuning.

The `DbEnv::log_printf()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### txnid

If the logged message refers to an application-specified transaction, the txnid parameter is a transaction handle returned from DbEnv::txn_begin(); otherwise NULL.

#### fmt

A format string that specifies how subsequent arguments (or arguments accessed via the variable-length argument facilities of stdarg(3)) are converted for output. The format string may contain any formatting directives supported by the underlying C library vsnprintf(3) function.

### Errors

The `DbEnv::log_printf()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DbEnv, DbLogc, DbLsn

### See Also

Logging Subsystem and Related Methods

Prev | Up | Next
DbEnv::log_get_config() | Home | DbEnv::log_put()