<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.network.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.openlog.php',
    1 => 'openlog',
    2 => 'Apre una connessione al logger di sistema',
  ),
  'up' => 
  array (
    0 => 'ref.network.php',
    1 => 'Network Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.net-get-interfaces.php',
    1 => 'net_get_interfaces',
  ),
  'next' => 
  array (
    0 => 'function.pfsockopen.php',
    1 => 'pfsockopen',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/network/functions/openlog.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openlog" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">openlog</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openlog</span> &mdash; <span class="dc-title">Apre una connessione al logger di sistema</span></p>
 
   </div>
   <div class="refsect1 unknown-1108" id="refsect1-function.openlog-unknown-1108">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>openlog</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$ident</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$option</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$facility</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

    <p class="para rdfs-comment">
     <span class="function"><strong>openlog()</strong></span> apre una connessione al logger di
     sistema per un programma. La stringa <code class="parameter">ident</code> viene
     aggiunta a ogni messaggio. Valori per <code class="parameter">option</code>
     e <code class="parameter">facility</code> sono dati di seguito.
     L&#039;argomento <code class="parameter">option</code> viene usato per indicare
     quali opzioni di loggin verranno usate durante la generazione di un messaggio di log.
     L&#039;argomento <code class="parameter">facility</code> viene usato per specificare quale 
     tipo di programma sta loggando il messaggio. Questo permette di specificare
     (nella comfigurazione del syslog della macchina) come trattare i messaggi provenienti dalle
     diverse facility.
     L&#039;uso di <span class="function"><strong>openlog()</strong></span> è opzionale. Viene
     chiamato automaticamente da <span class="function"><a href="function.syslog.php" class="function">syslog()</a></span> se
     necessario, in tal caso <code class="parameter">ident</code> sarà di default
     <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
    </p>
    <p class="para">
     <table class="doctable table">
      <caption><strong>Opzioni di <span class="function"><strong>openlog()</strong></span></strong></caption>
      
       <thead>
        <tr>
         <th>Costante</th>
         <th>Descrizione</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td>LOG_CONS</td>
         <td>
          se si verifica un errore durante l&#039;invio dei dati al logger di sistema,
          scrive direttamente sulla console di sistema
         </td>
        </tr>

        <tr>
         <td>LOG_NDELAY</td>
         <td>
          apre immediatamente una connessione al logger
         </td>
        </tr>

        <tr>
         <td>LOG_ODELAY</td>
         <td>
          (default) ritarda l&#039;apertura della connessione fino a quando non viene loggato 
          il primo messaggio
         </td>
        </tr>

        <tr>
         <td>LOG_PERROR</td>
         <td>stampa un messaggio di log anche su standard error</td>
        </tr>

        <tr>
         <td>LOG_PID</td>
         <td>include il PID in ciascun messaggio</td>
        </tr>

       </tbody>
      
     </table>

     Si possono usare una o più di queste opzioni. Usando opzioni multiple
     è necessario usare <code class="literal">OR</code>, ad esempio per aprire la connessione 
     immediatamente, scrivere sulla console e il PID in ciascun messaggio, 
     si dovrà usare: <code class="literal">LOG_CONS | LOG_NDELAY | LOG_PID</code>
    </p>
    <p class="para">
     <table class="doctable table">
      <caption><strong>Facility di <span class="function"><strong>openlog()</strong></span></strong></caption>
      
       <thead>
        <tr>
         <th>Costante</th>
         <th>Descrizione</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td>LOG_AUTH</td>
         <td>
          messaggi di sicurezza/autorizzazione (usa LOG_AUTHPRIV
          nei sistemi dove è definita quella costante)
         </td>
        </tr>

        <tr>
         <td>LOG_AUTHPRIV</td>
         <td>messaggi di sicurezza/autorizzazione (private)</td>
        </tr>

        <tr>
         <td>LOG_CRON</td>
         <td>clock daemon (cron e at)</td>
        </tr>

        <tr>
         <td>LOG_DAEMON</td>
         <td>altri demoni di sistema</td>
        </tr>

        <tr>
         <td>LOG_KERN</td>
         <td>messaggi del kernel</td>
        </tr>

        <tr>
         <td>LOG_LOCAL0 ... LOG_LOCAL7</td>
         <td>riservato per il locale</td>
        </tr>

        <tr>
         <td>LOG_LPR</td>
         <td>sottosistema line printer</td>
        </tr>

        <tr>
         <td>LOG_MAIL</td>
         <td>sottosistema mail</td>
        </tr>

        <tr>
         <td>LOG_NEWS</td>
         <td>sottosistema news di USENET</td>
        </tr>

        <tr>
         <td>LOG_SYSLOG</td>
         <td>messaggi generati internamente da syslogd</td>
        </tr>

        <tr>
         <td>LOG_USER</td>
         <td>messaggi generici user-level</td>
        </tr>

        <tr>
         <td>LOG_UUCP</td>
         <td>sottosistema UUCP</td>
        </tr>

       </tbody>
      
     </table>

    </p>
    <p class="para">
     Vedere anche <span class="function"><strong>define_syslog_variables()</strong></span>,
     <span class="function"><a href="function.syslog.php" class="function">syslog()</a></span> e
     <span class="function"><a href="function.closelog.php" class="function">closelog()</a></span>.
    </p>
   </div>

  </div><?php manual_footer($setup); ?>