Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 450759E74 for ; Fri, 7 Oct 2011 18:27:49 +0000 (UTC) Received: (qmail 22350 invoked by uid 500); 7 Oct 2011 18:27:49 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 22323 invoked by uid 500); 7 Oct 2011 18:27:49 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 22316 invoked by uid 99); 7 Oct 2011 18:27:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2011 18:27:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2011 18:27:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 75D352388C74; Fri, 7 Oct 2011 18:26:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1180134 [28/43] - in /logging/site/trunk/docs/log4php: ./ apidocs/ apidocs/log4php/ apidocs/log4php/appenders/ apidocs/log4php/configurators/ apidocs/log4php/filters/ apidocs/log4php/helpers/ apidocs/log4php/layouts/ apidocs/log4php/render... Date: Fri, 07 Oct 2011 18:26:14 -0000 To: commits@logging.apache.org From: ihabunek@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111007182628.75D352388C74@eris.apache.org> Modified: logging/site/trunk/docs/log4php/coverage-report/appenders_LoggerAppenderSyslog.php.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4php/coverage-report/appenders_LoggerAppenderSyslog.php.html?rev=1180134&r1=1180133&r2=1180134&view=diff ============================================================================== --- logging/site/trunk/docs/log4php/coverage-report/appenders_LoggerAppenderSyslog.php.html (original) +++ logging/site/trunk/docs/log4php/coverage-report/appenders_LoggerAppenderSyslog.php.html Fri Oct 7 18:26:07 2011 @@ -67,29 +67,29 @@ - +
45.45%45.45%83.33%83.33%
- 45.45% - 5 / 11 + 83.33% + 15 / 18 CRAP - +
42.59%42.59%94.29%94.29%
- 42.59% - 23 / 54 + 94.29% + 66 / 70   - LoggerAppenderSyslog + LoggerAppenderSyslog @@ -102,26 +102,26 @@ - - + + - - + + - +
- +
45.45%45.45%93.75%93.75%
45.45%5 / 1193.75%15 / 16 - +
42.59%42.59%98.21%98.21%
42.59%23 / 5498.21%55 / 56
 __construct($name = '') __destruct() @@ -144,7 +144,30 @@ - + + + + + + + + + + + +
 __destruct() setIdent($ident) + + + + +
100.00%100.00%
+
100.00%1 / 11 + + + + +
100.00%100.00%
+
100.00%3 / 3
 setPriority($priority) @@ -167,7 +190,7 @@ - +
 setDry($dry) setFacility($facility) @@ -190,122 +213,122 @@ - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + - +
 setIdent($ident) setOverridePriority($overridePriority) - +
0.00%0.00%100.00%100.00%
0.00%0 / 12100.00%1 / 11 - +
0.00%0.00%100.00%100.00%
0.00%0 / 2100.00%2 / 2
 setPriority($priority) setOption($option) - +
0.00%0.00%100.00%100.00%
0.00%0 / 12100.00%1 / 11 - +
0.00%0.00%100.00%100.00%
0.00%0 / 2100.00%2 / 2
 setFacility($facility) getIdent() - +
0.00%0.00%100.00%100.00%
0.00%0 / 12100.00%1 / 11 - +
0.00%0.00%100.00%100.00%
0.00%0 / 2100.00%2 / 2
 setOverridePriority($overridePriority) getPriority() - +
0.00%0.00%100.00%100.00%
0.00%0 / 12100.00%1 / 11 - +
0.00%0.00%100.00%100.00%
0.00%0 / 2100.00%1 / 1
 setOption($option) getFacility() - +
0.00%0.00%100.00%100.00%
0.00%0 / 12100.00%1 / 11 - +
0.00%0.00%100.00%100.00%
0.00%0 / 2100.00%1 / 1
 activateOptions() getOverridePriority() @@ -324,11 +347,57 @@
100.00%2 / 21 / 1
 getOption() + + + + +
100.00%100.00%
+
100.00%1 / 11 + + + + +
100.00%100.00%
+
100.00%1 / 1
 activateOptions() + + + + +
100.00%100.00%
+
100.00%1 / 11 + + + + +
100.00%100.00%
+
100.00%5 / 5
 close() close() @@ -351,7 +420,30 @@ - + + + + + + + + + + + +
 append(LoggerLoggingEvent $event) append(LoggerLoggingEvent $event) + + + + +
100.00%100.00%
+
100.00%1 / 11 + + + + +
100.00%100.00%
+
100.00%6 / 6
 getSyslogPriority(LoggerLevel $level) @@ -361,16 +453,117 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -386,220 +579,332 @@
0.00% 0 / 152.503.04 - +
30.00%30.00%83.33%83.33%
30.00%9 / 3083.33%5 / 6
 parseOption() + + + + +
100.00%100.00%
+
100.00%1 / 14 + + + + +
100.00%100.00%
+
100.00%11 / 11
Functions + + + + +
  
+
   + + + + +
0.00%0.00%
+
0.00%0 / 2 + + + + +
100.00%100.00%
+
100.00%0 / 0
 parseFacility() + + + + +
0.00%0.00%
+
0.00%0 / 13.04 + + + + +
83.33%83.33%
+
83.33%5 / 6
 parsePriority() + + + + +
0.00%0.00%
+
0.00%0 / 13.04 + + + + +
83.33%83.33%
+
83.33%5 / 6
-       1                 : <?php                                                                                                        
-       2                 : /**                                                                                                          
-       3                 :  * Licensed to the Apache Software Foundation (ASF) under one or more                                        
-       4                 :  * contributor license agreements. See the NOTICE file distributed with                                      
-       5                 :  * this work for additional information regarding copyright ownership.                                       
-       6                 :  * The ASF licenses this file to You under the Apache License, Version 2.0                                   
-       7                 :  * (the "License"); you may not use this file except in compliance with                                      
-       8                 :  * the License. You may obtain a copy of the License at                                                      
-       9                 :  *                                                                                                           
-      10                 :  *       http://www.apache.org/licenses/LICENSE-2.0                                                          
-      11                 :  *                                                                                                           
-      12                 :  * Unless required by applicable law or agreed to in writing, software                                       
-      13                 :  * distributed under the License is distributed on an "AS IS" BASIS,                                         
-      14                 :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                                  
-      15                 :  * See the License for the specific language governing permissions and                                       
-      16                 :  * limitations under the License.                                                                            
-      17                 :  *                                                                                                           
-      18                 :  * @package log4php                                                                                          
-      19                 :  */                                                                                                          
-      20                 :                                                                                                              
-      21                 : /**                                                                                                          
-      22                 :  * Log events using php {@link PHP_MANUAL#syslog} function.                                                  
-      23                 :  *                                                                                                           
-      24                 :  * This appender can be configured by changing the following attributes:                                     
-      25                 :  *                                                                                                           
-      26                 :  * - layout           - Sets the layout class for this appender                                              
-      27                 :  * - ident            - Set the ident of the syslog message.                                                 
-      28                 :  * - priority         - Set the priority value for the syslog message.                                       
-      29                 :  * - facility         - Set the facility value for the syslog message                                        
-      30                 :  * - overridePriority - If the priority of the message to be sent can be                                     
-      31                 :  *                      defined by a value in the properties-file, set                                       
-      32                 :  *                      parameter value to "true"                                                            
-      33                 :  * - option           - Set the option value for the syslog message.                                         
-      34                 :  *                      This value is used as a parameter for php openlog()                                  
-      35                 :  *                      and passed on to the syslog daemon.                                                  
-      36                 :  *                                                                                                           
-      37                 :  * Levels are mapped as follows:                                                                             
-      38                 :  * - <b>level >= FATAL</b> to LOG_ALERT                                                                      
-      39                 :  * - <b>FATAL > level >= ERROR</b> to LOG_ERR                                                                
-      40                 :  * - <b>ERROR > level >= WARN</b> to LOG_WARNING                                                             
-      41                 :  * - <b>WARN  > level >= INFO</b> to LOG_INFO                                                                
-      42                 :  * - <b>INFO  > level >= DEBUG</b> to LOG_DEBUG                                                              
-      43                 :  * - <b>DEBUG > level >= TRACE</b> to LOG_DEBUG                                                              
-      44                 :  *                                                                                                           
-      45                 :  * An example:                                                                                               
-      46                 :  *                                                                                                           
-      47                 :  * {@example ../../examples/php/appender_syslog.php 19}                                                      
-      48                 :  *                                                                                                           
-      49                 :  * {@example ../../examples/resources/appender_syslog.properties 18}                                         
-      50                 :  *                                                                                                           
-      51                 :  * @version $Revision: 1062665 $                                                                             
-      52                 :  * @package log4php                                                                                          
-      53                 :  * @subpackage appenders                                                                                     
-      54                 :  */                                                                                                          
-      55               1 : class LoggerAppenderSyslog extends LoggerAppender {                                                          
-      56                 :                                                                                                              
-      57                 :     /**                                                                                                      
-      58                 :      * The ident string is added to each message. Typically the name of your application.                    
-      59                 :      *                                                                                                       
-      60                 :      * @var string Ident for your application                                                                
-      61                 :      */                                                                                                      
-      62                 :     private $_ident = "Log4PHP Syslog-Event";                                                                
-      63                 :                                                                                                              
-      64                 :     /**                                                                                                      
-      65                 :      * The priority parameter value indicates the level of importance of the message.                        
-      66                 :      * It is passed on to the Syslog daemon.                                                                 
-      67                 :      *                                                                                                       
-      68                 :      * @var int Syslog priority                                                                              
-      69                 :      */                                                                                                      
-      70                 :     private $_priority;                                                                                      
-      71                 :                                                                                                              
-      72                 :     /**                                                                                                      
-      73                 :      * The option used when generating a log message.                                                        
-      74                 :      * It is passed on to the Syslog daemon.                                                                 
-      75                 :      *                                                                                                       
-      76                 :      * @var int Syslog priority                                                                              
-      77                 :      */                                                                                                      
-      78                 :     private $_option;                                                                                        
-      79                 :                                                                                                              
-      80                 :     /**                                                                                                      
-      81                 :      * The facility value indicates the source of the message.                                               
-      82                 :      * It is passed on to the Syslog daemon.                                                                 
-      83                 :      *                                                                                                       
-      84                 :      * @var const int Syslog facility                                                                        
-      85                 :      */                                                                                                      
-      86                 :     private $_facility;                                                                                      
-      87                 :                                                                                                              
-      88                 :     /**                                                                                                      
-      89                 :      * If it is necessary to define logging priority in the .properties-file,                                
-      90                 :      * set this variable to "true".                                                                          
-      91                 :      *                                                                                                       
-      92                 :      * @var const int value indicating whether the priority of the message is defined in the .properties-file
-      93                 :      *                   (or properties-array)                                                               
-      94                 :      */                                                                                                      
-      95                 :     private $_overridePriority;                                                                              
-      96                 :                                                                                                              
-      97                 :     /** @var indiciates if this appender should run in dry mode */                                           
-      98                 :     private $dry = false;                                                                                    
-      99                 :                                                                                                              
-     100                 :     public function __construct($name = '') {                                                                
-     101               2 :         parent::__construct($name);                                                                          
-     102               2 :     }                                                                                                        
-     103                 :                                                                                                              
-     104                 :     public function __destruct() {                                                                           
-     105               2 :         $this->close();                                                                                      
-     106               2 :     }                                                                                                        
-     107                 :                                                                                                              
-     108                 :     public function setDry($dry) {                                                                           
-     109               1 :         $this->dry = $dry;                                                                                   
-     110               1 :     }                                                                                                        
-     111                 :                                                                                                              
-     112                 :     /**                                                                                                      
-     113                 :      * Set the ident of the syslog message.                                                                  
-     114                 :      *                                                                                                       
-     115                 :      * @param string Ident                                                                                   
-     116                 :      */                                                                                                      
-     117                 :     public function setIdent($ident) {                                                                       
-     118               0 :         $this->_ident = $ident;                                                                              
-     119               0 :     }                                                                                                        
-     120                 :                                                                                                              
-     121                 :     /**                                                                                                      
-     122                 :      * Set the priority value for the syslog message.                                                        
-     123                 :      *                                                                                                       
-     124                 :      * @param const int Priority                                                                             
-     125                 :      */                                                                                                      
-     126                 :     public function setPriority($priority) {                                                                 
-     127               0 :         $this->_priority = $priority;                                                                        
-     128               0 :     }                                                                                                        
-     129                 :                                                                                                              
-     130                 :                                                                                                              
-     131                 :     /**                                                                                                      
-     132                 :      * Set the facility value for the syslog message.                                                        
-     133                 :      *                                                                                                       
-     134                 :      * @param const int Facility                                                                             
-     135                 :      */                                                                                                      
-     136                 :     public function setFacility($facility) {                                                                 
-     137               0 :         $this->_facility = $facility;                                                                        
-     138               0 :     }                                                                                                        
-     139                 :                                                                                                              
-     140                 :     /**                                                                                                      
-     141                 :      * If the priority of the message to be sent can be defined by a value in the properties-file,           
-     142                 :      * set parameter value to "true".                                                                        
-     143                 :      *                                                                                                       
-     144                 :      * @param bool Override priority                                                                         
-     145                 :      */                                                                                                      
-     146                 :     public function setOverridePriority($overridePriority) {                                                 
-     147               0 :         $this->_overridePriority = $overridePriority;                                                        
-     148               0 :     }                                                                                                        
-     149                 :                                                                                                              
-     150                 :     /**                                                                                                      
-     151                 :      * Set the option value for the syslog message.                                                          
-     152                 :      * This value is used as a parameter for php openlog()                                                   
-     153                 :      * and passed on to the syslog daemon.                                                                   
-     154                 :      *                                                                                                       
-     155                 :      * @param string    $option                                                                              
-     156                 :      */                                                                                                      
-     157                 :     public function setOption($option) {                                                                     
-     158               0 :         $this->_option = $option;                                                                            
-     159               0 :     }                                                                                                        
-     160                 :                                                                                                              
-     161                 :     public function activateOptions() {                                                                      
-     162                 :         // Deprecated as of 5.3 and removed in 6.0                                                           
-     163                 :         // define_syslog_variables();                                                                        
-     164               1 :         $this->closed = false;                                                                               
-     165               1 :     }                                                                                                        
-     166                 :                                                                                                              
-     167                 :     public function close() {                                                                                
-     168               2 :         if($this->closed != true) {                                                                          
-     169               2 :             closelog();                                                                                      
-     170               2 :             $this->closed = true;                                                                            
-     171               2 :         }                                                                                                    
-     172               2 :     }                                                                                                        
-     173                 :                                                                                                              
-     174                 :     public function append(LoggerLoggingEvent $event) {                                                      
-     175               1 :         if($this->_option == NULL){                                                                          
-     176               1 :             $this->_option = LOG_PID | LOG_CONS;                                                             
-     177               1 :         }                                                                                                    
-     178                 :                                                                                                              
-     179               1 :         $level     = $event->getLevel();                                                                     
-     180               1 :         if($this->layout === null) {                                                                         
-     181               0 :             $message = $event->getRenderedMessage();                                                         
-     182               0 :         } else {                                                                                             
-     183               1 :             $message = $this->layout->format($event);                                                        
-     184                 :         }                                                                                                    
-     185                 :                                                                                                              
-     186                 :         // If the priority of a syslog message can be overridden by a value defined in the properties-file,  
-     187                 :         // use that value, else use the one that is defined in the code.                                     
-     188               1 :         if(!$this->dry) {                                                                                    
-     189                 :             // Attach the process ID to the message, use the facility defined in the .properties-file        
-     190               0 :             openlog($this->_ident, $this->_option, $this->_facility);                                        
-     191                 :                                                                                                              
-     192               0 :             if($this->_overridePriority) {                                                                   
-     193               0 :                 syslog($this->_priority, $message);                                                          
-     194               0 :             } else {                                                                                         
-     195               0 :                 if($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {                                 
-     196               0 :                     syslog(LOG_ALERT, $message);                                                             
-     197               0 :                 } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {                         
-     198               0 :                     syslog(LOG_ERR, $message);                                                               
-     199               0 :                 } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {                          
-     200               0 :                     syslog(LOG_WARNING, $message);                                                           
-     201               0 :                 } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {                          
-     202               0 :                     syslog(LOG_INFO, $message);                                                              
-     203               0 :                 } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {                         
-     204               0 :                     syslog(LOG_DEBUG, $message);                                                             
-     205               0 :                 } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelTrace())) {                         
-     206               0 :                     syslog(LOG_DEBUG, $message);    // No trace level in syslog                              
-     207               0 :                 }                                                                                            
-     208                 :             }                                                                                                
-     209               0 :             closelog();                                                                                      
-     210               0 :         } else {                                                                                             
-     211               1 :             echo "DRY MODE OF SYSLOG APPENDER: ".$message;                                                   
-     212                 :         }                                                                                                    
-     213               1 :     }                                                                                                        
-     214                 : }                                                                                                            
+       1                 : <?php                                                                                                                                        
+       2                 : /**                                                                                                                                          
+       3                 :  * Licensed to the Apache Software Foundation (ASF) under one or more                                                                        
+       4                 :  * contributor license agreements. See the NOTICE file distributed with                                                                      
+       5                 :  * this work for additional information regarding copyright ownership.                                                                       
+       6                 :  * The ASF licenses this file to You under the Apache License, Version 2.0                                                                   
+       7                 :  * (the "License"); you may not use this file except in compliance with                                                                      
+       8                 :  * the License. You may obtain a copy of the License at                                                                                      
+       9                 :  *                                                                                                                                           
+      10                 :  *       http://www.apache.org/licenses/LICENSE-2.0                                                                                          
+      11                 :  *                                                                                                                                           
+      12                 :  * Unless required by applicable law or agreed to in writing, software                                                                       
+      13                 :  * distributed under the License is distributed on an "AS IS" BASIS,                                                                         
+      14                 :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                                                                  
+      15                 :  * See the License for the specific language governing permissions and                                                                       
+      16                 :  * limitations under the License.                                                                                                            
+      17                 :  *                                                                                                                                           
+      18                 :  * @package log4php                                                                                                                          
+      19                 :  */                                                                                                                                          
+      20                 :                                                                                                                                              
+      21                 : /**                                                                                                                                          
+      22                 :  * Log events to a system log using the {@link PHP_MANUAL#syslog} function.                                                                  
+      23                 :  *                                                                                                                                           
+      24                 :  * This appenders requires a layout.                                                                                                         
+      25                 :  *                                                                                                                                           
+      26                 :  * Configurable parameters:                                                                                                                  
+      27                 :  *                                                                                                                                           
+      28                 :  * - ident            - The ident of the syslog message.                                                                                     
+      29                 :  * - priority         - The priority for the syslog message (used when overriding priority).                                                 
+      30                 :  * - facility         - The facility for the syslog message                                                                                  
+      31                 :  * - overridePriority - If set to true, the message priority will always use                                                                 
+      32                 :  *                      the value defined in {@link $priority}, otherwise the                                                                
+      33                 :  *                      priority will be determined by the message's log level.                                                              
+      34                 :  * - option           - The option value for the syslog message.                                                                             
+      35                 :  *                                                                                                                                           
+      36                 :  * Recognised syslog options are:                                                                                                            
+      37                 :  *     - CONS      - if there is an error while sending data to the system logger, write directly to the system console                      
+      38                 :  *     - NDELAY - open the connection to the logger immediately                                                                              
+      39                 :  *     - ODELAY - delay opening the connection until the first message is logged (default)                                                   
+      40                 :  *     - PERROR - print log message also to standard error                                                                                   
+      41                 :  *     - PID    - include PID with each message                                                                                              
+      42                 :  *                                                                                                                                           
+      43                 :  * Multiple options can be set by delimiting them with a pipe character,                                                                     
+      44                 :  * e.g.: "CONS|PID|PERROR".                                                                                                                  
+      45                 :  *                                                                                                                                           

[... 698 lines stripped ...]