Ticket #1484850: syslog.diff
| File syslog.diff, 5.6 kB (added by rjhughes, 10 months ago) |
|---|
-
installer/config.php
99 99 <div>Use this folder to store temp files (must be writebale for webserver)</div> 100 100 </dd> 101 101 102 <dt class="propname">log_driver</dt> 103 <dd> 104 <?php 105 106 $select_log_driver = new select(array('name' => '_log_driver', 'id' => "cfglogdriver")); 107 $select_log_driver->add(array('file', 'syslog'), array('file', 'syslog')); 108 echo $select_log_driver->show($RCI->getprop('log_driver')); 109 110 ?> 111 <div>How to do logging? 'file': Write to files in the log directory. 'syslog': Use the syslog facility.</div> 112 </dd> 113 102 114 <dt class="propname">log_dir</dt> 103 115 <dd> 104 116 <?php … … 107 119 echo $input_logdir->show($RCI->getprop('log_dir')); 108 120 109 121 ?> 110 <div>Use this folder to store log files (must be writebale for webserver) </div>122 <div>Use this folder to store log files (must be writebale for webserver). Note that this only applies if you are using the 'file' log_driver.</div> 111 123 </dd> 112 124 125 <dt class="propname">syslog_id</dt> 126 <dd> 127 <?php 128 129 $input_syslogid = new textfield(array('name' => '_syslog_id', 'size' => 30, 'id' => "cfgsyslogid")); 130 echo $input_syslogid->show($RCI->getprop('syslog_id')); 131 132 ?> 133 <div>What ID to use when logging with syslog. Note that this only applies if you are using the 'syslog' log_driver.</div> 134 </dd> 135 113 136 <dt class="propname">ip_check</dt> 114 137 <dd> 115 138 <?php -
config/main.inc.php.dist
18 18 // system error reporting: 1 = log; 2 = report (not implemented yet), 4 = show, 8 = trace 19 19 $rcmail_config['debug_level'] = 1; 20 20 21 // log driver: 'syslog' or 'file'. 22 $rcmail_config['log_driver'] = 'file'; 23 24 // use this folder to store log files (must be writebale for apache user) 25 // This is used by the 'file' log driver. 26 $rcmail_config['log_dir'] = 'logs/'; 27 28 // Syslog id to use, if using the 'syslog' log driver. 29 $rcmail_config['syslog_id'] = 'roundcube'; 30 21 31 // enable caching of messages and mailbox data in the local database. 22 32 // this is recommended if the IMAP server does not run on the same machine 23 33 $rcmail_config['enable_caching'] = TRUE; … … 99 109 // use this folder to store temp files (must be writebale for apache user) 100 110 $rcmail_config['temp_dir'] = 'temp/'; 101 111 102 // use this folder to store log files (must be writebale for apache user)103 $rcmail_config['log_dir'] = 'logs/';104 105 112 // session lifetime in minutes 106 113 $rcmail_config['session_lifetime'] = 10; 107 114 -
program/include/bugs.inc
84 84 $CONFIG['log_dir'] = $INSTALL_PATH.'logs'; 85 85 86 86 // try to open specific log file for writing 87 if ($ fp = @fopen($CONFIG['log_dir'].'/errors', 'a'))87 if ($CONFIG['log_driver'] == 'syslog') 88 88 { 89 syslog(LOG_ERR, $log_entry); 90 } 91 else if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a')) 92 { 93 // log_driver == 'file' is the default, assumed here. 89 94 fwrite($fp, $log_entry); 90 95 fclose($fp); 91 96 } -
program/include/main.inc
151 151 else 152 152 $conf['log_dir'] = unslashify($conf['log_dir']); 153 153 154 if ($conf['log_driver'] == 'syslog') 155 openlog($conf['syslog_id'], 0, LOG_USER); 156 154 157 // set PHP error logging according to config 155 if ($conf['debug_level'] & 1) 156 { 158 if ($conf['debug_level'] & 1) { 157 159 ini_set('log_errors', 1); 158 ini_set('error_log', $conf['log_dir'].'/errors'); 159 } 160 if ($conf['log_driver'] == 'syslog') { 161 ini_set('error_log', 'syslog'); 162 } else { // log_driver == 'file' is assumed here. 163 ini_set('error_log', $conf['log_dir'].'/errors'); 164 } 165 } 160 166 if ($conf['debug_level'] & 4) 161 167 ini_set('display_errors', 1); 162 168 else … … 1602 1608 * @param $name Name of logfile 1603 1609 * @param $line Line to append 1604 1610 */ 1605 function write_log($name, $line) 1606 { 1611 function write_log($name, $line) { 1607 1612 global $CONFIG, $INSTALL_PATH; 1608 1613 1609 1614 if (!is_string($line)) … … 1616 1621 if (empty($CONFIG['log_dir'])) 1617 1622 $CONFIG['log_dir'] = $INSTALL_PATH.'logs'; 1618 1623 1619 // try to open specific log file for writing 1620 if ($fp = @fopen($CONFIG['log_dir'].'/'.$name, 'a')) 1621 { 1622 fwrite($fp, $log_entry); 1623 fclose($fp); 1624 if ($CONFIG['log_driver'] == 'syslog') { 1625 if ($name == 'errors') 1626 $priority = LOG_ERR; 1627 else 1628 $priority = LOG_INFO; 1629 1630 syslog($priority, $log_entry); 1631 } else { // log_driver == 'file' is assumed here 1632 // try to open specific log file for writing 1633 if ($fp = @fopen($CONFIG['log_dir'].'/'.$name, 'a')) { 1634 fwrite($fp, $log_entry); 1635 fclose($fp); 1624 1636 } 1625 1637 } 1638 } 1626 1639 1627 1640 1628 1641 /** -
program/steps/mail/sendmail.inc
402 402 $mailto, 403 403 !empty($smtp_response) ? join('; ', $smtp_response) : ''); 404 404 405 if ($fp = @fopen($CONFIG['log_dir'].'/sendmail', 'a')) 405 if ($CONFIG['log_driver'] == 'syslog') 406 syslog(LOG_INFO, $log_entry); 407 else if ($fp = @fopen($CONFIG['log_dir'].'/sendmail', 'a')) 406 408 { 409 // log_driver == 'file' is assumed here. 407 410 fwrite($fp, $log_entry); 408 411 fclose($fp); 409 412 }
