1<!--$Id: db_set_errfile.so,v 10.10 2002/08/18 21:15:54 bostic Exp $-->
2<!--$Id: env_set_errfile.so,v 10.37 2006/10/26 15:33:59 bostic Exp $-->
3<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
4<!--See the file LICENSE for redistribution information.-->
5<html>
6<head>
7<title>Berkeley DB: Db::set_errfile</title>
8<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
10</head>
11<body bgcolor=white>
12<table width="100%"><tr valign=top>
13<td>
14<b>Db::set_errfile</b>
15</td>
16<td align=right>
17<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
18<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
19</tr></table>
20<hr size=1 noshade>
21<tt>
22<b><pre>
23#include &lt;db_cxx.h&gt;
24<p>
25void Db::set_errfile(FILE *errfile);
26<p>
27void Db::get_errfile(FILE **errfilep);
28</pre></b>
29<hr size=1 noshade>
30<b>Description: Db::set_errfile</b>
31When an error occurs in the Berkeley DB library, an exception is thrown or an
32error return value is returned by the interface.  In some cases,
33however, the exception or returned value may be insufficient to
34completely describe the cause of the error, especially during initial
35application debugging.
36<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
37enhance the mechanism for reporting error messages to the application
38by setting a C library FILE * to be used for displaying additional Berkeley DB
39error messages.  In some cases, when an error occurs, Berkeley DB will output
40an additional error message to the specified file reference.</p>
41<p>Alternatively, you can use the <a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> method to display
42the additional information via an output stream, or the
43<a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a> method to capture the additional error information in
44a way that does not use either output streams or C library FILE *'s.  You
45should not mix these approaches.</p>
46<p>The error message will consist of the prefix string and a colon
47("<b>:</b>") (if a prefix string was previously specified using
48<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
49a trailing &lt;newline&gt; character.</p>
50<p>The default configuration when applications first create <a href="../api_cxx/db_class.html">Db</a> or
51<a href="../api_cxx/env_class.html">DbEnv</a> handles is as if the <a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a> or
52Db::set_errfile methods were called with the standard error output
53(stderr) specified as the FILE * argument.  Applications wanting no
54output at all can turn off this default configuration by calling the
55<a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a> or Db::set_errfile methods with NULL as the
56FILE * argument.  Additionally, explicitly configuring the error output
57channel using any of the <a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a>,
58Db::set_errfile, <a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a>,
59<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
60<a href="../api_cxx/db_set_error_stream.html">Db::set_error_stream</a> methods will also turn off this default output
61for the application.</p>
62<p>This error logging enhancement does not slow performance or significantly
63increase application size, and may be run during normal operation as well
64as during application debugging.</p>
65<p>For <a href="../api_cxx/db_class.html">Db</a> handles opened inside of Berkeley DB environments, calling the
66Db::set_errfile method affects the entire environment and is equivalent to calling
67the <a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a> method.</p>
68<p>The Db::set_errfile method configures operations performed using the specified
69<a href="../api_cxx/db_class.html">Db</a> handle, not all operations performed on the underlying
70database.</p>
71<p>The Db::set_errfile method may be called at any time during the life of the
72application.</p>
73<b>Parameters</b> <br>
74 <b>errfile</b><ul compact><li>The <b>errfile</b> parameter is a C library FILE * to be used for
75displaying additional Berkeley DB error information.</ul>
76<br>
77<hr size=1 noshade>
78<b>Description: Db::get_errfile</b>
79<p>The Db::get_errfile method returns the FILE *.</p>
80<p>The Db::get_errfile method may be called at any time during the life of the
81application.</p>
82<p>The Db::get_errfile 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>errfilep</b><ul compact><li>The Db::get_errfile method returns  the
89FILE * in <b>errfilep</b>.</ul>
90<br>
91<hr size=1 noshade>
92<br><b>Class</b>
93<a href="../api_cxx/db_class.html">Db</a>
94<br><b>See Also</b>
95<a href="../api_cxx/db_list.html">Databases 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