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-&gt;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-&gt;set_errfile</b>
15</td>
16<td align=right>
17<a href="/api_c/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.h&gt;
24<p>
25void
26DB-&gt;set_errfile(DB *db, FILE *errfile);
27<p>
28void
29DB-&gt;get_errfile(DB *db, FILE **errfilep);
30</pre></b>
31<hr size=1 noshade>
32<b>Description: DB-&gt;set_errfile</b>
33When an error occurs in the Berkeley DB library, a Berkeley DB error or an error
34return value is returned by the interface.  In some cases, however, the
35return value may be insufficient to completely describe the cause of the
36error especially during initial application debugging.
37<p>The <a href="/api_c/env_set_errfile.html">DB_ENV-&gt;set_errfile</a> and DB-&gt;set_errfile 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>The error message will consist of the prefix string and a colon
43("<b>:</b>") (if a prefix string was previously specified using
44<a href="/api_c/db_set_errpfx.html">DB-&gt;set_errpfx</a> or <a href="/api_c/env_set_errpfx.html">DB_ENV-&gt;set_errpfx</a>), an error string, and
45a trailing &lt;newline&gt; character.</p>
46<p>The default configuration when applications first create <a href="/api_c/db_class.html">DB</a> or
47<a href="/api_c/env_class.html">DB_ENV</a> handles is as if the <a href="/api_c/env_set_errfile.html">DB_ENV-&gt;set_errfile</a> or
48DB-&gt;set_errfile methods were called with the standard error output
49(stderr) specified as the FILE * argument.  Applications wanting no
50output at all can turn off this default configuration by calling the
51<a href="/api_c/env_set_errfile.html">DB_ENV-&gt;set_errfile</a> or DB-&gt;set_errfile methods with NULL as the
52FILE * argument.  Additionally, explicitly configuring the error output
53channel using any of the <a href="/api_c/env_set_errfile.html">DB_ENV-&gt;set_errfile</a>,
54DB-&gt;set_errfile, <a href="/api_c/env_set_errcall.html">DB_ENV-&gt;set_errcall</a>,
55<a href="/api_c/db_set_errcall.html">DB-&gt;set_errcall</a>, <a href="/api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> or
56<a href="/api_cxx/db_set_error_stream.html">Db::set_error_stream</a> methods will also turn off this default output
57for the application.</p>
58<p>This error logging enhancement does not slow performance or significantly
59increase application size, and may be run during normal operation as well
60as during application debugging.</p>
61<p>For <a href="/api_c/db_class.html">DB</a> handles opened inside of Berkeley DB environments, calling the
62DB-&gt;set_errfile method affects the entire environment and is equivalent to calling
63the <a href="/api_c/env_set_errfile.html">DB_ENV-&gt;set_errfile</a> method.</p>
64<p>The DB-&gt;set_errfile method configures operations performed using the specified
65<a href="/api_c/db_class.html">DB</a> handle, not all operations performed on the underlying
66database.</p>
67<p>The DB-&gt;set_errfile method may be called at any time during the life of the
68application.</p>
69<b>Parameters</b> <br>
70 <b>errfile</b><ul compact><li>The <b>errfile</b> parameter is a C library FILE * to be used for
71displaying additional Berkeley DB error information.</ul>
72<br>
73<hr size=1 noshade>
74<b>Description: DB-&gt;get_errfile</b>
75<p>The DB-&gt;get_errfile method returns the FILE *.</p>
76<p>The DB-&gt;get_errfile method may be called at any time during the life of the
77application.</p>
78<p>The DB-&gt;get_errfile method
79returns a non-zero error value on failure
80and 0 on success.
81</p>
82<b>Parameters</b> <br>
83 <b>errfilep</b><ul compact><li>The DB-&gt;get_errfile method returns  the
84FILE * in <b>errfilep</b>.</ul>
85<br>
86<hr size=1 noshade>
87<br><b>Class</b>
88<a href="/api_c/db_class.html">DB</a>
89<br><b>See Also</b>
90<a href="/api_c/db_list.html">Databases 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