mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
246 lines
7.5 KiB
HTML
246 lines
7.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Open connection to system logger</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.openlog" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">openlog</h1>
|
||
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">openlog</span> — <span class="dc-title">Open connection to system logger</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.openlog-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>openlog</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$ident</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$facility</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>openlog()</strong></span> opens a connection to the system
|
||
logger for a program.
|
||
</p>
|
||
<p class="para">
|
||
The use of <span class="function"><strong>openlog()</strong></span> is optional. It
|
||
will automatically be called by <span class="function"><a href="syslog.html" class="function">syslog()</a></span> if
|
||
necessary, in which case <code class="parameter">ident</code> will default
|
||
to <strong><code>FALSE</code></strong>.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.openlog-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">ident</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The string <code class="parameter">ident</code> is added to each message.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">option</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The <code class="parameter">option</code> argument is used to indicate
|
||
what logging options will be used when generating a log message.
|
||
<table class="doctable table">
|
||
<caption><strong><span class="function"><strong>openlog()</strong></span> Options</strong></caption>
|
||
|
||
<thead>
|
||
<tr>
|
||
<th>Constant</th>
|
||
<th>Description</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="tbody">
|
||
<tr>
|
||
<td><strong><code>LOG_CONS</code></strong></td>
|
||
<td>
|
||
if there is an error while sending data to the system logger,
|
||
write directly to the system console
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_NDELAY</code></strong></td>
|
||
<td>
|
||
open the connection to the logger immediately
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_ODELAY</code></strong></td>
|
||
<td>
|
||
(default) delay opening the connection until the first
|
||
message is logged
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_PERROR</code></strong></td>
|
||
<td>print log message also to standard error</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_PID</code></strong></td>
|
||
<td>include PID with each message</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
You can use one or more of these options. When using multiple options
|
||
you need to <em>OR</em> them, i.e. to open the connection
|
||
immediately, write to the console and include the PID in each message,
|
||
you will use: <em>LOG_CONS | LOG_NDELAY | LOG_PID</em>
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">facility</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
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.
|
||
<table class="doctable table">
|
||
<caption><strong><span class="function"><strong>openlog()</strong></span> Facilities</strong></caption>
|
||
|
||
<thead>
|
||
<tr>
|
||
<th>Constant</th>
|
||
<th>Description</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="tbody">
|
||
<tr>
|
||
<td><strong><code>LOG_AUTH</code></strong></td>
|
||
<td>
|
||
security/authorization messages (use
|
||
<strong><code>LOG_AUTHPRIV</code></strong> instead
|
||
in systems where that constant is defined)
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_AUTHPRIV</code></strong></td>
|
||
<td>security/authorization messages (private)</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_CRON</code></strong></td>
|
||
<td>clock daemon (cron and at)</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_DAEMON</code></strong></td>
|
||
<td>other system daemons</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_KERN</code></strong></td>
|
||
<td>kernel messages</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_LOCAL0</code></strong> ... <strong><code>LOG_LOCAL7</code></strong></td>
|
||
<td>reserved for local use, these are not available in Windows</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_LPR</code></strong></td>
|
||
<td>line printer subsystem</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_MAIL</code></strong></td>
|
||
<td>mail subsystem</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_NEWS</code></strong></td>
|
||
<td>USENET news subsystem</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_SYSLOG</code></strong></td>
|
||
<td>messages generated internally by syslogd</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_USER</code></strong></td>
|
||
<td>generic user-level messages</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LOG_UUCP</code></strong></td>
|
||
<td>UUCP subsystem</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
</p>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
<strong><code>LOG_USER</code></strong> is the only valid log type under Windows
|
||
operating systems
|
||
</p>
|
||
</p></blockquote>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.openlog-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.openlog-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="syslog.html" class="function" rel="rdfs-seeAlso">syslog()</a> - Generate a system log message</span></li>
|
||
<li class="member"><span class="function"><a href="closelog.html" class="function" rel="rdfs-seeAlso">closelog()</a> - 关闭系统日志链接</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |