<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >openlog</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Network - Funções de Rede" HREF="ref.network.html"><LINK REL="PREVIOUS" TITLE="long2ip" HREF="function.long2ip.html"><LINK REL="NEXT" TITLE="pfsockopen" HREF="function.pfsockopen.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.long2ip.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pfsockopen.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.openlog" ></A >openlog</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN144362" ></A ><P > (PHP 3, PHP 4, PHP 5)</P >openlog -- Open connection to system logger</DIV ><DIV CLASS="refsect1" ><A NAME="AEN144365" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >openlog</B > ( string ident, int option, int facility )<BR ></BR ><P > <B CLASS="function" >openlog()</B > opens a connection to the system logger for a program. The string <CODE CLASS="parameter" >ident</CODE > is added to each message. Values for <CODE CLASS="parameter" >option</CODE > and <CODE CLASS="parameter" >facility</CODE > are given below. The <CODE CLASS="parameter" >option</CODE > argument is used to indicate what logging options will be used when generating a log message. The <CODE CLASS="parameter" >facility</CODE > argument is used to specify what type of program is logging the message. This allows you to specify (in your machine's syslog configuration) how messages coming from different facilities will be handled. The use of <B CLASS="function" >openlog()</B > is optional. It will automatically be called by <A HREF="function.syslog.html" ><B CLASS="function" >syslog()</B ></A > if necessary, in which case <CODE CLASS="parameter" >ident</CODE > will default to <TT CLASS="constant" ><B >FALSE</B ></TT >. </P ><P > <DIV CLASS="table" ><A NAME="AEN144391" ></A ><P ><B >Tabela 1. <B CLASS="function" >openlog()</B > Options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Constant</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >LOG_CONS</TD ><TD > if there is an error while sending data to the system logger, write directly to the system console </TD ></TR ><TR ><TD >LOG_NDELAY</TD ><TD > open the connection to the logger immediately </TD ></TR ><TR ><TD >LOG_ODELAY</TD ><TD > (default) delay opening the connection until the first message is logged </TD ></TR ><TR ><TD >LOG_PERROR</TD ><TD >print log message also to standard error</TD ></TR ><TR ><TD >LOG_PID</TD ><TD >include PID with each message</TD ></TR ></TBODY ></TABLE ></DIV > You can use one or more of this options. When using multiple options you need to <TT CLASS="literal" >OR</TT > them, i.e. to open the connection immediately, write to the console and include the PID in each message, you will use: <TT CLASS="literal" >LOG_CONS | LOG_NDELAY | LOG_PID</TT > </P ><P > <DIV CLASS="table" ><A NAME="AEN144418" ></A ><P ><B >Tabela 2. <B CLASS="function" >openlog()</B > Facilities</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Constant</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >LOG_AUTH</TD ><TD > security/authorization messages (use LOG_AUTHPRIV instead in systems where that constant is defined) </TD ></TR ><TR ><TD >LOG_AUTHPRIV</TD ><TD >security/authorization messages (private)</TD ></TR ><TR ><TD >LOG_CRON</TD ><TD >clock daemon (cron and at)</TD ></TR ><TR ><TD >LOG_DAEMON</TD ><TD >other system daemons</TD ></TR ><TR ><TD >LOG_KERN</TD ><TD >kernel messages</TD ></TR ><TR ><TD >LOG_LOCAL0 ... LOG_LOCAL7</TD ><TD >reserved for local use, these are not available in Windows</TD ></TR ><TR ><TD >LOG_LPR</TD ><TD >line printer subsystem</TD ></TR ><TR ><TD >LOG_MAIL</TD ><TD >mail subsystem</TD ></TR ><TR ><TD >LOG_NEWS</TD ><TD >USENET news subsystem</TD ></TR ><TR ><TD >LOG_SYSLOG</TD ><TD >messages generated internally by syslogd</TD ></TR ><TR ><TD >LOG_USER</TD ><TD >generic user-level messages</TD ></TR ><TR ><TD >LOG_UUCP</TD ><TD >UUCP subsystem</TD ></TR ></TBODY ></TABLE ></DIV > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > <TT CLASS="literal" >LOG_USER</TT > is the only valid log type under Windows operating systems </P ></BLOCKQUOTE ></DIV ><P > See also <A HREF="function.define-syslog-variables.html" ><B CLASS="function" >define_syslog_variables()</B ></A >, <A HREF="function.syslog.html" ><B CLASS="function" >syslog()</B ></A > and <A HREF="function.closelog.html" ><B CLASS="function" >closelog()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.long2ip.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pfsockopen.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >long2ip</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.network.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >pfsockopen</TD ></TR ></TABLE ></DIV ></BODY ></HTML >