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: DbEnv::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>DbEnv::set_lg_dir</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25DbEnv::set_lg_dir(const char *dir); 26<p> 27int 28DbEnv::get_lg_dir(const char **dirp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DbEnv::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 DbEnv::set_lg_dir method configures operations performed using the specified 48<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying 49database environment.</p> 50<p>The DbEnv::set_lg_dir method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is 51called. 52If the database environment already exists when 53<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_lg_dir 54must be consistent with the existing environment or corruption can 55occur.</p> 56<p>The DbEnv::set_lg_dir method 57either returns a non-zero error value 58or throws an exception that encapsulates a non-zero error value on 59failure, and returns 0 on success. 60</p> 61<b>Parameters</b> <br> 62 <b>dir</b><ul compact><li>The <b>dir</b> parameter is the directory used to store the logging files.</ul> 63<p>When using a Unicode build on Windows (the default), the <b>dir</b> 64argument will be interpreted as a UTF-8 string, which is equivalent to 65ASCII for Latin characters.</p> 66<br> 67<br><b>Errors</b> 68<p>The DbEnv::set_lg_dir method 69may fail and throw 70<a href="../api_cxx/except_class.html">DbException</a>, 71encapsulating one of the following non-zero errors, or return one of 72the following non-zero errors:</p> 73<br> 74<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called; or if an 75invalid flag value or parameter was specified.</ul> 76<br> 77<hr size=1 noshade> 78<b>Description: DbEnv::get_lg_dir</b> 79<p>The DbEnv::get_lg_dir method returns the log directory.</p> 80<p>The DbEnv::get_lg_dir method may be called at any time during the life of the 81application.</p> 82<p>The DbEnv::get_lg_dir method 83either returns a non-zero error value 84or throws an exception that encapsulates a non-zero error value on 85failure, and returns 0 on success. 86</p> 87<b>Parameters</b> <br> 88 <b>dirp</b><ul compact><li>The DbEnv::get_lg_dir method returns a reference to the 89log directory in <b>dirp</b>.</ul> 90<br> 91<hr size=1 noshade> 92<br><b>Class</b> 93<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/logc_class.html">DbLogc</a>, <a href="../api_cxx/lsn_class.html">DbLsn</a> 94<br><b>See Also</b> 95<a href="../api_cxx/log_list.html">Logging Subsystem and Related Methods</a> 96</tt> 97<table width="100%"><tr><td><br></td><td align=right> 98<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 99</td></tr></table> 100<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 101</body> 102</html> 103