1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>DbEnv::set_lg_dir()</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> 10 <link rel="up" href="lsn.html" title="Chapter��8.�� The DbLsn Handle" /> 11 <link rel="prev" href="envset_lg_bsize.html" title="DbEnv::set_lg_bsize()" /> 12 <link rel="next" href="envset_lg_filemode.html" title="DbEnv::set_lg_filemode()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::set_lg_dir()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envset_lg_bsize.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��8.�� 23 The DbLsn Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="envset_lg_filemode.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="envset_lg_dir"></a>DbEnv::set_lg_dir()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::set_lg_dir(const char *dir); </pre> 42 <p> 43 The path of a directory to be used as the location of logging files. 44 Log files created by the Log Manager subsystem will be created in this 45 directory. 46 </p> 47 <p> 48 If no logging directory is specified, log files are created in the 49 environment home directory. See <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a> for more 50 information. 51 </p> 52 <p> 53 For the greatest degree of recoverability from system or application 54 failure, database files and log files should be located on separate 55 physical devices. 56 </p> 57 <p> 58 The database environment's logging directory may also be configured 59 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 60 syntax of the entry in that file is a single line with the string 61 "set_lg_dir", one or more whitespace characters, and the directory 62 name. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 63 read when the database environment is opened, it will silently 64 overrule configuration done before that time. 65 </p> 66 <p> 67 The <code class="methodname">DbEnv::set_lg_dir()</code> method configures operations performed using 68 the specified <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> 69 handle, not all operations performed on the underlying database 70 environment. 71 </p> 72 <p> 73 The <code class="methodname">DbEnv::set_lg_dir()</code> method may not be called after the 74 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called. 75 If the database environment already exists when 76 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> is called, the 77 information specified to <code class="methodname">DbEnv::set_lg_dir()</code> must be consistent with 78 the existing environment or corruption can occur. 79 </p> 80 <p> 81 The <code class="methodname">DbEnv::set_lg_dir()</code> <span> 82 83 <span> 84 method either returns a non-zero error value or throws an 85 exception that encapsulates a non-zero error value on 86 failure, and returns 0 on success. 87 </span> 88 </span> 89 </p> 90 <div class="sect2" lang="en" xml:lang="en"> 91 <div class="titlepage"> 92 <div> 93 <div> 94 <h3 class="title"><a id="id1687914"></a>Parameters</h3> 95 </div> 96 </div> 97 </div> 98 <div class="sect3" lang="en" xml:lang="en"> 99 <div class="titlepage"> 100 <div> 101 <div> 102 <h4 class="title"><a id="id1687948"></a>dir</h4> 103 </div> 104 </div> 105 </div> 106 <p> 107 The <span class="bold"><strong>dir</strong></span> parameter is the directory 108 used to store the logging files. 109 </p> 110 <p> 111 When using a Unicode build on Windows (the default), the 112 <span class="bold"><strong>dir</strong></span> argument will be interpreted 113 as a UTF-8 string, which is equivalent to ASCII for Latin characters. 114 </p> 115 </div> 116 </div> 117 <div class="sect2" lang="en" xml:lang="en"> 118 <div class="titlepage"> 119 <div> 120 <div> 121 <h3 class="title"><a id="id1688101"></a>Errors</h3> 122 </div> 123 </div> 124 </div> 125 <p> 126 The <code class="methodname">DbEnv::set_lg_dir()</code> <span> 127 128 <span> 129 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 130 exception, encapsulating one of the following non-zero errors, or return one 131 of the following non-zero errors: 132 </span> 133 </span> 134 </p> 135 <div class="sect3" lang="en" xml:lang="en"> 136 <div class="titlepage"> 137 <div> 138 <div> 139 <h4 class="title"><a id="id1688027"></a>EINVAL</h4> 140 </div> 141 </div> 142 </div> 143 <p> 144 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> 145 was called; or if an invalid flag value or parameter was specified. 146 </p> 147 </div> 148 </div> 149 <div class="sect2" lang="en" xml:lang="en"> 150 <div class="titlepage"> 151 <div> 152 <div> 153 <h3 class="title"><a id="id1687942"></a>Class</h3> 154 </div> 155 </div> 156 </div> 157 <p> 158 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a>, 159 <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, 160 <a class="link" href="lsn.html" title="Chapter��8.�� The DbLsn Handle">DbLsn</a> 161 </p> 162 </div> 163 <div class="sect2" lang="en" xml:lang="en"> 164 <div class="titlepage"> 165 <div> 166 <div> 167 <h3 class="title"><a id="id1688050"></a>See Also</h3> 168 </div> 169 </div> 170 </div> 171 <p> 172 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 173 </p> 174 </div> 175 </div> 176 <div class="navfooter"> 177 <hr /> 178 <table width="100%" summary="Navigation footer"> 179 <tr> 180 <td width="40%" align="left"><a accesskey="p" href="envset_lg_bsize.html">Prev</a>��</td> 181 <td width="20%" align="center"> 182 <a accesskey="u" href="lsn.html">Up</a> 183 </td> 184 <td width="40%" align="right">��<a accesskey="n" href="envset_lg_filemode.html">Next</a></td> 185 </tr> 186 <tr> 187 <td width="40%" align="left" valign="top">DbEnv::set_lg_bsize()��</td> 188 <td width="20%" align="center"> 189 <a accesskey="h" href="index.html">Home</a> 190 </td> 191 <td width="40%" align="right" valign="top">��DbEnv::set_lg_filemode()</td> 192 </tr> 193 </table> 194 </div> 195 </body> 196</html> 197