Library Version 18.1.40

DB_ENV->set_lg_filemode()
Prev | Chapter 7. The DB_LSN Handle | Next

## DB_ENV->set_lg_filemode()

    #include <db.h>

    int
    DB_ENV->set_lg_filemode(DB_ENV *dbenv, int lg_filemode);

Set the absolute file mode for created log files. This method is only useful for the rare Berkeley DB application that does not control its umask value.

Normally, if Berkeley DB applications set their umask appropriately, all processes in the application suite will have read permission on the log files created by any process in the application suite. However, if the Berkeley DB application is a library, a process using the library might set its umask to a value preventing other processes in the application suite from reading the log files it creates. In this rare case, the `DB_ENV->set_lg_filemode()` method can be used to set the mode of created log files to an absolute value.

The database environment's log file mode may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "set_lg_filemode", one or more whitespace characters, and the absolute mode of created log files. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The `DB_ENV->set_lg_filemode()` method configures a database environment, not only operations performed using the specified DB_ENV handle.

The `DB_ENV->set_lg_filemode()` method may be called at any time during the life of the application.

The `DB_ENV->set_lg_filemode()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### lg_filemode

The lg_filemode parameter is the absolute mode of the created log file.

### Class

DB_ENV, DB_LOGC, DB_LSN

### See Also

Logging Subsystem and Related Methods

Prev | Up | Next
DB_ENV->set_lg_dir() | Home | DB_ENV->set_lg_max()