1<!--$Id: env_set_lg_dir.so,v 10.25 2004/09/28 15:04:21 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;set_lg_dir</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;set_lg_dir</b>
14</td>
15<td align=right>
16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;set_lg_dir(DB_ENV *dbenv, const char *dir);
26<p>
27int
28DB_ENV-&gt;get_lg_dir(DB_ENV *dbenv, const char **dirp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;set_lg_dir</b>
32<p>The path of a directory to be used as the location of logging files.
33Log files created by the Log Manager subsystem will be created in this
34directory.</p>
35<p>If no logging directory is specified, log files are created in the
36environment home directory.   See <a href="../ref/env/naming.html">Berkeley DB File Naming</a> for more information.</p>
37<p>For the greatest degree of recoverability from system or application
38failure, database files and log files should be located on separate
39physical devices.</p>
40<p>The database environment's logging directory may also be configured using the
41environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
42file is a single line with the string "set_lg_dir", one or more whitespace
43characters, and the directory name.
44Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
45is opened, it will silently overrule configuration done before that
46time.</p>
47<p>The DB_ENV-&gt;set_lg_dir method configures operations performed using the specified
48<a href="../api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying
49database environment.</p>
50<p>The DB_ENV-&gt;set_lg_dir method may not be called after the <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> method is
51called.
52If the database environment already exists when
53<a href="../api_c/env_open.html">DB_ENV-&gt;open</a> is called, the information specified to DB_ENV-&gt;set_lg_dir
54must be consistent with the existing environment or corruption can
55occur.</p>
56<p>The DB_ENV-&gt;set_lg_dir method
57returns a non-zero error value on failure
58and 0 on success.
59</p>
60<b>Parameters</b> <br>
61 <b>dir</b><ul compact><li>The <b>dir</b> parameter is the directory used to store the logging files.</ul>
62<p>When using a Unicode build on Windows (the default), the <b>dir</b>
63argument will be interpreted as a UTF-8 string, which is equivalent to
64ASCII for Latin characters.</p>
65<br>
66<br><b>Errors</b>
67<p>The DB_ENV-&gt;set_lg_dir method
68may fail and return one of the following non-zero errors:</p>
69<br>
70<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> was called; or if an
71invalid flag value or parameter was specified.</ul>
72<br>
73<hr size=1 noshade>
74<b>Description: DB_ENV-&gt;get_lg_dir</b>
75<p>The DB_ENV-&gt;get_lg_dir method returns the log directory.</p>
76<p>The DB_ENV-&gt;get_lg_dir method may be called at any time during the life of the
77application.</p>
78<p>The DB_ENV-&gt;get_lg_dir method
79returns a non-zero error value on failure
80and 0 on success.
81</p>
82<b>Parameters</b> <br>
83 <b>dirp</b><ul compact><li>The DB_ENV-&gt;get_lg_dir method returns a reference to the
84log directory in <b>dirp</b>.</ul>
85<br>
86<hr size=1 noshade>
87<br><b>Class</b>
88<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/logc_class.html">DB_LOGC</a>, <a href="../api_c/lsn_class.html">DB_LSN</a>
89<br><b>See Also</b>
90<a href="../api_c/log_list.html">Logging Subsystem and Related Methods</a>
91</tt>
92<table width="100%"><tr><td><br></td><td align=right>
93<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
94</td></tr></table>
95<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
96</body>
97</html>
98