CC-2186: Integration of a logger tool
-initial check-in. Everything appears to be working...
This commit is contained in:
parent
3b1e79a5d8
commit
171828f8ad
|
@ -10,6 +10,7 @@ Propel::init(__DIR__."/configs/airtime-conf.php");
|
|||
$tz = ini_get('date.timezone') ? ini_get('date.timezone') : 'UTC';
|
||||
date_default_timezone_set($tz);
|
||||
|
||||
require_once __DIR__."/logging/Logging.php";
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once __DIR__."/configs/conf.php";
|
||||
require_once 'DB.php';
|
||||
|
@ -33,8 +34,8 @@ if (PEAR::isError($CC_DBC)) {
|
|||
exit(1);
|
||||
}
|
||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||
|
||||
//Zend_Session::start();
|
||||
Zend_Validate::setDefaultNamespaces("Zend");
|
||||
|
||||
$front = Zend_Controller_Front::getInstance();
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
class Logging {
|
||||
|
||||
private static $_logger;
|
||||
private static $_path;
|
||||
|
||||
public static function getLogger(){
|
||||
if (!isset(self::$logger)) {
|
||||
$writer = new Zend_Log_Writer_Stream(self::$_path);
|
||||
self::$_logger = new Zend_Log($writer);
|
||||
}
|
||||
return self::$_logger;
|
||||
}
|
||||
|
||||
public static function setLogPath($path){
|
||||
self::$_path = $path;
|
||||
}
|
||||
}
|
|
@ -90,6 +90,8 @@ AirtimeInstall::ChangeDirOwnerToWebserver($CC_CONFIG["storageDir"]);
|
|||
|
||||
AirtimeInstall::CreateSymlinksToUtils();
|
||||
|
||||
AirtimeInstall::CreateZendPhpLogFile();
|
||||
|
||||
echo PHP_EOL."*** Pypo Installation ***".PHP_EOL;
|
||||
system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ system($command);
|
|||
|
||||
AirtimeInstall::RemoveSymlinks();
|
||||
AirtimeInstall::UninstallBinaries();
|
||||
AirtimeInstall::RemoveLogDirectories();
|
||||
|
||||
echo PHP_EOL;
|
||||
echo "****************************** Uninstall Complete ******************************".PHP_EOL;
|
||||
|
|
|
@ -8,6 +8,7 @@ class AirtimeInstall
|
|||
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
||||
const CONF_DIR_STORAGE = "/srv/airtime";
|
||||
const CONF_DIR_WWW = "/var/www/airtime";
|
||||
const CONF_DIR_LOG = "/var/log/airtime";
|
||||
|
||||
public static function GetAirtimeSrcDir()
|
||||
{
|
||||
|
@ -318,4 +319,28 @@ class AirtimeInstall
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function CreateZendPhpLogFile(){
|
||||
global $CC_CONFIG;
|
||||
|
||||
echo "* Creating logs directory ".AirtimeInstall::CONF_DIR_LOG.PHP_EOL;
|
||||
|
||||
$path = AirtimeInstall::CONF_DIR_LOG;
|
||||
$file = $path.'/zendphp.log';
|
||||
if (!file_exists($path)){
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
|
||||
touch($file);
|
||||
chmod($file, 0755);
|
||||
chown($file, $CC_CONFIG['webServerUser']);
|
||||
chgrp($file, $CC_CONFIG['webServerUser']);
|
||||
}
|
||||
|
||||
public static function RemoveLogDirectories(){
|
||||
$path = AirtimeInstall::CONF_DIR_LOG;
|
||||
echo "* Removing logs directory ".$path.PHP_EOL;
|
||||
|
||||
exec("rm -rf $path");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,10 +38,7 @@ try:
|
|||
sys.exit()
|
||||
|
||||
os.system("python /usr/bin/airtime-pypo-stop")
|
||||
|
||||
print "Removing log directories"
|
||||
remove_path(config["log_base_dir"])
|
||||
|
||||
|
||||
print "Removing cache directories"
|
||||
remove_path(config["cache_base_dir"])
|
||||
|
||||
|
|
Loading…
Reference in New Issue