| 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>DB_ENV->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 7. The DB_LSN Handle" /> |
| 11 | <link rel="prev" href="envset_lg_bsize.html" title="DB_ENV->set_lg_bsize()" /> |
| 12 | <link rel="next" href="envset_lg_filemode.html" title="DB_ENV->set_lg_filemode()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DB_ENV->set_lg_dir()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_lg_bsize.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 7. |
| 26 | The DB_LSN Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envset_lg_filemode.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="envset_lg_dir"></a>DB_ENV->set_lg_dir()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->set_lg_dir(DB_ENV *dbenv, const char *dir); </pre> |
| 45 | <p> |
| 46 | The path of a directory to be used as the location of logging files. |
| 47 | Log files created by the Log Manager subsystem will be created in this |
| 48 | directory. |
| 49 | </p> |
| 50 | <p> |
| 51 | If no logging directory is specified, log files are created in the |
| 52 | environment home directory. See |
| 53 | <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a> |
| 54 | for more information. |
| 55 | </p> |
| 56 | <p> |
| 57 | For the greatest degree of recoverability from system or application |
| 58 | failure, database files and log files should be located on separate |
| 59 | physical devices. |
| 60 | </p> |
| 61 | <p> |
| 62 | The database environment's logging directory may also be |
| 63 | configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax |
| 64 | of the entry in that file is a single line with the string |
| 65 | "set_lg_dir", one or more whitespace characters, and the directory |
| 66 | name. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read when the database |
| 67 | environment is opened, it will silently overrule configuration |
| 68 | done before that time. Note that if you use this method for your |
| 69 | application, and you also want to use the |
| 70 | <a class="xref" href="db_recover.html" title="db_recover">db_recover</a>, |
| 71 | <a class="xref" href="db_printlog.html" title="db_printlog">db_printlog</a>, |
| 72 | <a class="xref" href="db_archive.html" title="db_archive">db_archive</a>, or |
| 73 | <a class="xref" href="db_log_verify.html" title="db_log_verify">db_log_verify</a> |
| 74 | utilities, then you should set create a <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file and set |
| 75 | the "set_lg_dir" parameter in it. |
| 76 | </p> |
| 77 | <p> |
| 78 | The <code class="methodname">DB_ENV->set_lg_dir()</code> method configures operations performed using |
| 79 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 80 | handle, not all operations performed on the underlying database |
| 81 | environment. |
| 82 | </p> |
| 83 | <p> |
| 84 | The <code class="methodname">DB_ENV->set_lg_dir()</code> method may not be called after the |
| 85 | <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. |
| 86 | If the database environment already exists when |
| 87 | <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> is called, the |
| 88 | information specified to <code class="methodname">DB_ENV->set_lg_dir()</code> must be consistent with |
| 89 | the existing environment or corruption can occur. |
| 90 | </p> |
| 91 | <p> |
| 92 | The <code class="methodname">DB_ENV->set_lg_dir()</code> <span> |
| 93 | <span> |
| 94 | method returns a non-zero error value on failure and 0 on success. |
| 95 | </span> |
| 96 | |
| 97 | </span> |
| 98 | </p> |
| 99 | <div class="sect2" lang="en" xml:lang="en"> |
| 100 | <div class="titlepage"> |
| 101 | <div> |
| 102 | <div> |
| 103 | <h3 class="title"><a id="idp52998864"></a>Parameters</h3> |
| 104 | </div> |
| 105 | </div> |
| 106 | </div> |
| 107 | <div class="sect3" lang="en" xml:lang="en"> |
| 108 | <div class="titlepage"> |
| 109 | <div> |
| 110 | <div> |
| 111 | <h4 class="title"><a id="idp53019480"></a>dir</h4> |
| 112 | </div> |
| 113 | </div> |
| 114 | </div> |
| 115 | <p> |
| 116 | The <span class="bold"><strong>dir</strong></span> parameter is the |
| 117 | directory used to store the logging files. This |
| 118 | directory must currently exist at environment open time. |
| 119 | </p> |
| 120 | <p> |
| 121 | When using a Unicode build on Windows (the default), the |
| 122 | <span class="bold"><strong>dir</strong></span> argument will be |
| 123 | interpreted as a UTF-8 string, which is equivalent to |
| 124 | ASCII for Latin characters. |
| 125 | </p> |
| 126 | </div> |
| 127 | </div> |
| 128 | <div class="sect2" lang="en" xml:lang="en"> |
| 129 | <div class="titlepage"> |
| 130 | <div> |
| 131 | <div> |
| 132 | <h3 class="title"><a id="idp53010232"></a>Errors</h3> |
| 133 | </div> |
| 134 | </div> |
| 135 | </div> |
| 136 | <p> |
| 137 | The <code class="methodname">DB_ENV->set_lg_dir()</code> <span> |
| 138 | <span> |
| 139 | method may fail and return one of the following non-zero errors: |
| 140 | </span> |
| 141 | |
| 142 | </span> |
| 143 | </p> |
| 144 | <div class="sect3" lang="en" xml:lang="en"> |
| 145 | <div class="titlepage"> |
| 146 | <div> |
| 147 | <div> |
| 148 | <h4 class="title"><a id="idp53037480"></a>EINVAL</h4> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | <p> |
| 153 | If the method was called after <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> |
| 154 | was called; or if an invalid flag value or parameter was specified. |
| 155 | </p> |
| 156 | </div> |
| 157 | </div> |
| 158 | <div class="sect2" lang="en" xml:lang="en"> |
| 159 | <div class="titlepage"> |
| 160 | <div> |
| 161 | <div> |
| 162 | <h3 class="title"><a id="idp53036400"></a>Class</h3> |
| 163 | </div> |
| 164 | </div> |
| 165 | </div> |
| 166 | <p> |
| 167 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>, |
| 168 | <a class="link" href="logc.html" title="The DB_LOGC Handle">DB_LOGC</a>, |
| 169 | <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> |
| 170 | </p> |
| 171 | </div> |
| 172 | <div class="sect2" lang="en" xml:lang="en"> |
| 173 | <div class="titlepage"> |
| 174 | <div> |
| 175 | <div> |
| 176 | <h3 class="title"><a id="idp53039608"></a>See Also</h3> |
| 177 | </div> |
| 178 | </div> |
| 179 | </div> |
| 180 | <p> |
| 181 | <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> |
| 182 | </p> |
| 183 | </div> |
| 184 | </div> |
| 185 | <div class="navfooter"> |
| 186 | <hr /> |
| 187 | <table width="100%" summary="Navigation footer"> |
| 188 | <tr> |
| 189 | <td width="40%" align="left"><a accesskey="p" href="envset_lg_bsize.html">Prev</a> </td> |
| 190 | <td width="20%" align="center"> |
| 191 | <a accesskey="u" href="lsn.html">Up</a> |
| 192 | </td> |
| 193 | <td width="40%" align="right"> <a accesskey="n" href="envset_lg_filemode.html">Next</a></td> |
| 194 | </tr> |
| 195 | <tr> |
| 196 | <td width="40%" align="left" valign="top">DB_ENV->set_lg_bsize() </td> |
| 197 | <td width="20%" align="center"> |
| 198 | <a accesskey="h" href="index.html">Home</a> |
| 199 | </td> |
| 200 | <td width="40%" align="right" valign="top"> DB_ENV->set_lg_filemode()</td> |
| 201 | </tr> |
| 202 | </table> |
| 203 | </div> |
| 204 | </body> |
| 205 | </html> |