Library Version 12.1.6.2

DbEnv::set_msgcall()
Prev | Chapter 5. The DbEnv Handle | Next

## DbEnv::set_msgcall()

    #include <db_cxx.h>

    void DbEnv::set_msgcall(void (*db_msgcall_fcn)(const DbEnv *dbenv,
                                                   const char *msgpfx,
                                                   const char *msg));

There are interfaces in the Berkeley DB library which either directly output informational messages or statistical information, or configure the library to output such messages when performing other operations, for example, DbEnv::set_verbose() and DbEnv::stat_print().

The `DbEnv::set_msgcall()` and Db::set_msgcall() methods are used to pass these messages to the application, and Berkeley DB will call db_msgcall_fcn with each message. It is up to the db_msgcall_fcn function to display the message in an appropriate manner.

Setting db_msgcall_fcn to NULL unconfigures the callback interface.

Alternatively, you can use the DbEnv::set_error_stream() and Db::set_error_stream() methods to display the messages via an output stream, or the Db::set_msgfile() or Db::set_msgfile() methods to display the messages via a C library FILE *. You should not mix these approaches.

The `DbEnv::set_msgcall()` method configures operations performed using the specified DbEnv handle, not all operations performed on the underlying database environment.

The `DbEnv::set_msgcall()` method may be called at any time during the life of the application.

### Note

Berkeley DB is not re-entrant. Callback functions should not attempt to make library calls (for example, to release locks or close open handles). Re-entering Berkeley DB is not guaranteed to work correctly, and the results are undefined.

### Parameters

#### db_msgcall_fcn

The db_msgcall_fcn parameter is the application-specified message reporting function. The function takes three parameters:

- `dbenv`

  The dbenv parameter is the enclosing database environment.

- `msgpfx`

  The msgpfx parameter is the message prefix string that appears before informational messages. This value is the environmental default, and can be changed at any time using DbEnv::set_msgpfx() or Db::set_msgpfx().

- `msg`

  The msg parameter is the message string.

### Class

DbEnv

### See Also

Database Environments and Related Methods

Prev | Up | Next
DbEnv::set_message_stream() | Home | DbEnv::set_msgfile()