<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.errorfunc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.error-log.php',
    1 => 'error_log',
    2 => 'Env&iacute;a un mensaje de error al gestor de errores definido',
  ),
  'up' => 
  array (
    0 => 'ref.errorfunc.php',
    1 => 'Funciones de Manejo de Errores',
  ),
  'prev' => 
  array (
    0 => 'function.error-get-last.php',
    1 => 'error_get_last',
  ),
  'next' => 
  array (
    0 => 'function.error-reporting.php',
    1 => 'error_reporting',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/errorfunc/functions/error-log.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.error-log" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">error_log</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">error_log</span> &mdash; <span class="dc-title">Envía un mensaje de error al gestor de errores definido</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.error-log-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>error_log</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$message</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$message_type</code><span class="initializer"> = 0</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$destination</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$additional_headers</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Envía un mensaje de error al historial de errores
   del servidor web o a un fichero.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.error-log-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">message</code></dt>
     <dd>
      <p class="para">
       El mensaje de error que debe ser almacenado.
      </p>
     </dd>
    
    
     <dt><code class="parameter">message_type</code></dt>
     <dd>
      <p class="para">
       Especifica el destino del mensaje de error.
       Los tipos posibles de mensajes son:
      </p>
      <p class="para">
       <table class="doctable table">
        <caption><strong><span class="function"><strong>error_log()</strong></span> tipos de registro</strong></caption>
        
         <tbody class="tbody">
          <tr>
           <td>0</td>
           <td>
            <code class="parameter">message</code> es enviado al historial
            PHP, que se basa en el historial del sistema o un fichero,
            dependiendo de la configuración de <a href="errorfunc.configuration.php#ini.error-log" class="link">error_log</a>. Esta es la opción por omisión.
           </td>
          </tr>

          <tr>
           <td>1</td>
           <td>
            <code class="parameter">message</code> es enviado por email a
            la dirección <code class="parameter">destination</code>. Este es el único tipo que
            utiliza el cuarto parámetro
            <code class="parameter">additional_headers</code>.
           </td>
          </tr>

          <tr>
           <td>2</td>
           <td>
            Ya no es una opción.
           </td>
          </tr>

          <tr>
           <td>3</td>
           <td>
            <code class="parameter">message</code> es añadido al fichero
            <code class="parameter">destination</code>. No se añade automáticamente una nueva línea
            (retorno de carro) al final de la cadena
            <code class="parameter">message</code>.
           </td>
          </tr>

          <tr>
           <td>4</td>
           <td>
           <code class="parameter">message</code> es enviado directamente al gestor de identificación SAPI.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">destination</code></dt>
     <dd>
      <p class="para">
       El destino. Esto depende del parámetro
       <code class="parameter">message_type</code> descrito anteriormente.
      </p>
     </dd>
    
    
     <dt><code class="parameter">additional_headers</code></dt>
     <dd>
      <p class="para">
       Los encabezados adicionales. Estos son utilizados cuando el parámetro
       <code class="parameter">message_type</code> está definido a
       <code class="literal">1</code>. Este tipo de mensaje utiliza la misma función interna
       que la función <span class="function"><a href="function.mail.php" class="function">mail()</a></span>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.error-log-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Esta función retorna <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en caso de éxito o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si ocurre un error.
   Si <code class="parameter">message_type</code> es cero, entonces esta función siempre retorna <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>,
   independientemente de si el error pudo ser registrado en el registro de eventos.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.error-log-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">destination</code> y
       <code class="parameter">additional_headers</code>
       ahora son nullables.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.error-log-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplos con <span class="function"><strong>error_log()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Envía una notificación por el historial del servidor web,<br />// si la conexión a la base de datos es imposible.<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">Ora_Logon</span><span style="color: #007700">(</span><span style="color: #0000BB">$username</span><span style="color: #007700">, </span><span style="color: #0000BB">$password</span><span style="color: #007700">)) {<br />  </span><span style="color: #0000BB">error_log</span><span style="color: #007700">(</span><span style="color: #DD0000">"Base Oracle no disponible !"</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">// Indicar al administrador, por email, que no hay más FOO<br /></span><span style="color: #007700">if (!(</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #0000BB">allocate_new_foo</span><span style="color: #007700">())) {<br />  </span><span style="color: #0000BB">error_log</span><span style="color: #007700">(</span><span style="color: #DD0000">"¡Ay!, No quedan más FOO disponibles !"</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">,<br />  </span><span style="color: #DD0000">"operador@example.com"</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">// Otras maneras de llamar a error_log():<br /></span><span style="color: #0000BB">error_log</span><span style="color: #007700">(</span><span style="color: #DD0000">"¡Gran error !"</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #DD0000">"/var/tmp/mis-errors.log"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.error-log-notes">
  <h3 class="title">Notas</h3>
  <div class="warning"><strong class="warning">Advertencia</strong>
   <p class="simpara">
    La función <span class="function"><strong>error_log()</strong></span> no es segura a nivel binario.
    El parámetro <code class="parameter">message</code> será truncado por un carácter nulo.
   </p>
  </div>
  <div class="tip"><strong class="tip">Sugerencia</strong>
   <p class="simpara">
    El parámetro <code class="parameter">message</code> no debe contener caracteres
    nulos. Tenga en cuenta que el parámetro <code class="parameter">message</code> puede ser enviado
    hacia un fichero, un correo, syslog, etc. Utilice las funciones apropiadas de
    conversión/escape, <span class="function"><a href="function.base64-encode.php" class="function">base64_encode()</a></span>, <span class="function"><a href="function.rawurlencode.php" class="function">rawurlencode()</a></span>
    o <span class="function"><a href="function.addslashes.php" class="function">addslashes()</a></span> antes de llamar a la función <span class="function"><strong>error_log()</strong></span>.
   </p>
  </div>
 </div>


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