Library Version 12.1.6.2

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

## DbEnv::log_file()

    #include <db_cxx.h>

    int
    DbEnv::log_file(const DbLsn *lsn, char *namep, size_t len);

The `DbEnv::log_file()` method maps `DbLsn` structures to filenames, returning the name of the file containing the record named by lsn.

This mapping of `DbLsn` structures to files is needed for database administration. For example, a transaction manager typically records the earliest DbLsn needed for restart, and the database administrator may want to archive log files to tape when they contain only DbLsn entries before the earliest one needed for restart.

The `DbEnv::log_file()` 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

#### lsn

The lsn parameter is the `DbLsn` structure for which a filename is wanted.

#### namep

The namep parameter references memory into which the name of the file containing the record named by lsn is copied.

#### len

The len parameter is the length of the namep buffer in bytes. If namep is too short to hold the filename, `DbEnv::log_file()` will fail. (Log filenames are always 14 characters long.)

### Errors

The `DbEnv::log_file()` 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

If the supplied buffer was too small to hold the log filename; or if an invalid flag value or parameter was specified.

### Class

DbEnv, DbLogc, DbLsn

### See Also

Logging Subsystem and Related Methods

Prev | Up | Next
DbEnv::log_cursor() | Home | DbEnv::log_flush()