Changeset 6059

Show
Ignore:
Timestamp:
07/19/08 08:20:19 (3 months ago)
Author:
p_lindheimer
Message:

#1843: making logging default disabled and add new option to log to syslog instead of sql, see ticket for new amportal.conf paramters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r5969 r6059  
    3333        'FOPPASSWORD'    => array('std' , 'passw0rd'), 
    3434        'FOPSORT'        => array('std' , 'extension'), 
     35        'AMPSYSLOGLEVEL '=> array('std' , 'LOG_ERR'), 
    3536 
    3637        'ASTETCDIR'      => array('dir' , '/etc/asterisk'), 
     
    6061        'USEDEVSTATE'    => array('bool' , false), 
    6162        'MODULEADMINWGET'=> array('bool' , false), 
     63        'AMPDISABLELOG'=> array('bool' , true), 
     64        'AMPENABLEDEVELDEBUG'=> array('bool' , false), 
    6265); 
    6366 
     
    35053508 */ 
    35063509function freepbx_log($section, $level, $message) { 
    3507         global $db; 
    3508         global $debug; // This is used by retrieve_conf 
    3509         global $amp_conf; 
     3510        global $db; 
     3511        global $debug; // This is used by retrieve_conf 
     3512        global $amp_conf; 
     3513 
     3514        if (isset($debug) && ($debug != false)) { 
     3515                print "[DEBUG-$section] ($level) $message\n"; 
     3516        } 
     3517        if (!$amp_conf['AMPENABLEDEVELDEBUG'] && strtolower(trim($level)) == 'devel-debug') { 
     3518                return true; 
     3519        } 
    35103520         
    3511         if (!isset($amp_conf['AMPDISABLELOG']) || ($amp_conf['AMPDISABLELOG'] != 'true')) { 
    3512             $sth = $db->prepare("INSERT INTO freepbx_log (time, section, level, message) VALUES (NOW(),?,?,?)"); 
    3513             $db->execute($sth, array($section, $level, $message)); 
    3514         } 
    3515         if (isset($debug) && ($debug != false)) 
    3516                 print "[DEBUG-$section] ($level) $message\n"; 
     3521        if (!$amp_conf['AMPDISABLELOG']) { 
     3522                switch (strtoupper($amp_conf['AMPSYSLOGLEVEL'])) { 
     3523                        case 'LOG_EMERG': 
     3524                                syslog(LOG_EMERG,"FreePBX-[$level][$section] $message"); 
     3525                                break; 
     3526                        case 'LOG_ALERT': 
     3527                                syslog(LOG_ALERT,"FreePBX-[$level][$section] $message"); 
     3528                                break; 
     3529                        case 'LOG_CRIT': 
     3530                                syslog(LOG_CRIT,"FreePBX-[$level][$section] $message"); 
     3531                                break; 
     3532                        case 'LOG_ERR': 
     3533                                syslog(LOG_ERR,"FreePBX-[$level][$section] $message"); 
     3534                                break; 
     3535                        case 'LOG_WARNING': 
     3536                                syslog(LOG_WARNING,"FreePBX-[$level][$section] $message"); 
     3537                                break; 
     3538                        case 'LOG_NOTICE': 
     3539                                syslog(LOG_NOTICE,"FreePBX-[$level][$section] $message"); 
     3540                                break; 
     3541                        case 'LOG_INFO': 
     3542                                syslog(LOG_INFO,"FreePBX-[$level][$section] $message"); 
     3543                                break; 
     3544                        case 'LOG_DEBUG': 
     3545                                syslog(LOG_DEBUG,"FreePBX-[$level][$section] $message"); 
     3546                                break; 
     3547                        case 'SQL': 
     3548                        case 'LOG_SQL': 
     3549                        default: 
     3550                                $sth = $db->prepare("INSERT INTO freepbx_log (time, section, level, message) VALUES (NOW(),?,?,?)"); 
     3551                                $db->execute($sth, array($section, $level, $message)); 
     3552                                break; 
     3553                } 
     3554 
     3555        } 
    35173556} 
    35183557 
  • freepbx/trunk/amportal.conf

    r5967 r6059  
    147147SERVERINTITLE=false 
    148148 
    149 # USEDEVSTATE = true DEFAULT VALUE false 
     149# USEDEVSTATE = true|false # DEFAULT VALUE false 
    150150# If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the 
    151151# func_devstate.c backport available from Asterisk 1.6 which allows custom hints to be created to support 
     
    154154USEDEVSTATE=true 
    155155 
    156 # MODULEADMINWGET=true DEFAULT VALUE false 
     156# MODULEADMINWGET=true|false # DEFAULT VALUE false 
    157157# Module Admin normally tries to get its online information through direct file open type calls to URLs that 
    158158# go back to the freepbx.org server. If it fails, typically because of content filters in firewalls that don't 
     
    163163# 
    164164MODULEADMINWGET=true 
     165 
     166# AMPDISABLELOG=true|false # DEFAULT VALUE true 
     167# Whether or not to invoke the freepbx log facility 
     168 
     169# AMPSYSLOGLEVEL=LOG_EMERG|LOG_ALERT|LOG_CRIT|LOG_ERR|LOG_WARNING|LOG_NOTICE|LOG_INFO|LOG_DEBUG|LOG_SQL|SQL # DEFAULT VALUE LOG_ERR 
     170# Where to log if enabled, SQL, LOG_SQL logs to old MySQL table, others are passed to syslog system to determine where to log 
     171 
     172# AMPENABLEDEVELDEBUG=true|false # DEFAULT VALUE false 
     173# Whether or not to include log messages marked as 'devel-debug' in the log system 
     174 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads