1<!--$Id: env_set_errfile.so,v 10.37 2006/10/26 15:33:59 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_errfile</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_errfile</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 &lt;db_cxx.h&gt;
23<p>
24void
25DbEnv::set_errfile(FILE *errfile);
26<p>
27void
28DbEnv::get_errfile(FILE **errfilep);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_errfile</b>
32When an error occurs in the Berkeley DB library, an exception is thrown or an
33error return value is returned by the interface.  In some cases,
34however, the exception or returned value may be insufficient to
35completely describe the cause of the error, especially during initial
36application debugging.
37<p>The <a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a> and <a href="../api_cxx/db_set_errcall.html">Db::set_errcall</a> methods are used to
38enhance the mechanism for reporting error messages to the application
39by setting a C library FILE * to be used for displaying additional Berkeley DB
40error messages.  In some cases, when an error occurs, Berkeley DB will output
41an additional error message to the specified file reference.</p>
42<p>Alternatively, you can use the <a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> method to display
43the additional information via an output stream, or the
44<a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a> method to capture the additional error information in
45a way that does not use either output streams or C library FILE *'s.  You
46should not mix these approaches.</p>
47<p>The error message will consist of the prefix string and a colon
48("<b>:</b>") (if a prefix string was previously specified using
49<a href="../api_cxx/db_set_errpfx.html">Db::set_errpfx</a> or <a href="../api_cxx/env_set_errpfx.html">DbEnv::set_errpfx</a>), an error string, and
50a trailing &lt;newline&gt; character.</p>
51<p>The default configuration when applications first create <a href="../api_cxx/db_class.html">Db</a> or
52<a href="../api_cxx/env_class.html">DbEnv</a> handles is as if the DbEnv::set_errfile or
53<a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a> methods were called with the standard error output
54(stderr) specified as the FILE * argument.  Applications wanting no
55output at all can turn off this default configuration by calling the
56DbEnv::set_errfile or <a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a> methods with NULL as the
57FILE * argument.  Additionally, explicitly configuring the error output
58channel using any of the DbEnv::set_errfile,
59<a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a>, <a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a>,
60<a href="../api_cxx/db_set_errcall.html">Db::set_errcall</a>, <a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> or
61<a href="../api_cxx/db_set_error_stream.html">Db::set_error_stream</a> methods will also turn off this default output
62for the application.</p>
63<p>This error logging enhancement does not slow performance or significantly
64increase application size, and may be run during normal operation as well
65as during application debugging.</p>
66<p>The DbEnv::set_errfile method configures operations performed using the specified
67<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
68database environment.</p>
69<p>The DbEnv::set_errfile method may be called at any time during the life of the
70application.</p>
71<b>Parameters</b> <br>
72 <b>errfile</b><ul compact><li>The <b>errfile</b> parameter is a C library FILE * to be used for
73displaying additional Berkeley DB error information.</ul>
74<br>
75<hr size=1 noshade>
76<b>Description: DbEnv::get_errfile</b>
77<p>The DbEnv::get_errfile method returns the FILE *.</p>
78<p>The DbEnv::get_errfile method may be called at any time during the life of the
79application.</p>
80<p>The DbEnv::get_errfile method
81either returns a non-zero error value
82or throws an exception that encapsulates a non-zero error value on
83failure, and returns 0 on success.
84</p>
85<b>Parameters</b> <br>
86 <b>errfilep</b><ul compact><li>The DbEnv::get_errfile method returns  the
87FILE * in <b>errfilep</b>.</ul>
88<br>
89<hr size=1 noshade>
90<br><b>Class</b>
91<a href="../api_cxx/env_class.html">DbEnv</a>
92<br><b>See Also</b>
93<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
94</tt>
95<table width="100%"><tr><td><br></td><td align=right>
96<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>
97</td></tr></table>
98<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
99</body>
100</html>
101