|
|
|
Description
Description
</H2
><DIV
CLASS="funcsynopsis"
><A
NAME="AEN11630"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="function"
>error_log</B
></CODE
> (string message, int message_type [, string
destination [, string
extra_headers]])</CODE
></P
><P
></P
></DIV
><P
> Sends an error message to the web server's error log, a
<SPAN
CLASS="acronym"
>TCP</SPAN
> port or to a file. The first parameter,
<TT
CLASS="parameter"
><I
>message</I
></TT
>, is the error message that should
be logged. The second parameter,
<TT
CLASS="parameter"
><I
>message_type</I
></TT
> says where the message should
go:
<DIV
CLASS="table"
><A
NAME="AEN11648"
></A
><P
><B
>Table 1. <B
CLASS="function"
>error_log()</B
> log types</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>0</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
> <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent to PHP's system
logger, using the Operating System's system logging
mechanism or a file, depending on what the <A
HREF="get_example.php3?Function=configuration#ini.error-log"
>error_log</A
> configuration
directive is set to.
</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>1</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
> <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent by email to the
address in the <TT
CLASS="parameter"
><I
>destination</I
></TT
> parameter.
This is the only message type where the fourth parameter,
<TT
CLASS="parameter"
><I
>extra_headers</I
></TT
> is used. This message
type uses the same internal function as
<B
CLASS="function"
>Mail()</B
> does.
</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>2</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
> <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent through the PHP debugging
connection. This option is only available if <A
HREF="get_example.php3?Function=install.configure#install.configure.enable-debugger"
>remote debugging has
been enabled</A
>. In this case, the
<TT
CLASS="parameter"
><I
>destination</I
></TT
> parameter specifies the host
name or IP address and optionally, port number, of the socket
receiving the debug information.
</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>3</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
> <TT
CLASS="parameter"
><I
>message</I
></TT
> is appended to the file
<TT
CLASS="parameter"
><I
>destination</I
></TT
>.
</TD
></TR
></TBODY
></TABLE
></DIV
>
</P
><P
> <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN11677"
></A
><P
><B
>Example 1. <B
CLASS="function"
>error_log()</B
> examples</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
> // Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon ($username, $password)) {
error_log ("Oracle database not available!", 0);
}
// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo()) {
error_log ("Big trouble, we're all out of FOOs!", 1,
"operator@mydomain.com");
}
// other ways of calling error_log():
error_log ("You messed up!", 2, "127.0.0.1:7000");
error_log ("You messed up!", 2, "loghost");
error_log ("You messed up!", 3, "/var/tmp/my-errors.log");
</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
</P
></DIV
>
|
|
| DB Connection Function with error handling and email failure notices Categories : PHP, MySQL, Errors and Logging, Databases, Errors and Logging | | | A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors Categories : PHP, Variables, Errors and Logging | | | Logging 404 errors in your custom statistics using Apache and a PHP script. Categories : Apache, Web Servers, PHP, Errors and Logging | | | Visits-tracking Categories : PHP, Databases, MySQL, Errors and Logging, Functions | | | Error mailing logging facility Categories : PHP, Errors and Logging, Email | | | Ping a Server and run a command to fix it if it is down Categories : PHP, Errors and Logging, Regexps | | | A Custom Error Handling And Debugging Class Categories : PHP, PHP Classes, Debugging, Errors and Logging | | | Building a basic error handler with custom error types Categories : PHP, PHP Classes, Errors and Logging | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Example of function to send out email if error occurs Categories : PHP, Email, Debugging, Errors and Logging | | | [PHP5] PHP Debugger and Helper Categories : PHP, PHP Classes, Errors and Logging, Debugging, XML | | | error_reporting -- set which PHP errors are reported Categories : PHP, PHP Functions, Errors and Logging | | | Intelligent 404 Handler Categories : PHP, Errors and Logging | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | |
|
|
|