YULLogger.class.php 1.37 KB
<?php
require_once(dirname(__FILE__).'/../log4php/Logger.php');

class YULLogger
{
    private static $dailyLogger = null;
    private static $dbLogger = null;
    
    public static function getDailyLogger()
    {
        if (!isset(self::$dailyLogger))
        {
            Logger::configure(dirname(__FILE__).'/config/appender_daily.properties');
            self::$dailyLogger = Logger::getRootLogger();
        }
        // 20111014 dan: 删除此处var_dump
        return self::$dailyLogger;
    }
    
	public static function getDBLogger()
    {
        if (!isset(self::$dbLogger))
        {
            Logger::configure(dirname(__FILE__).'/config/appender_pdo.properties');
            self::$dbLogger = Logger::getRootLogger();
        }
        return self::$dbLogger;
    }
    
    public static function destroyDailyLogger()
    {
        if (isset(self::$dailyLogger))
        {
            try
            {
                self::$dailyLogger->shutdown();
                
            } catch (Exception $e)
            {
                // TODO 
            }
        }
    }
    
    public static function destroyDBLogger()
    {
        if (isset(self::$dbLogger))
        {
            try
            {
                self::$dbLogger->shutdown();
                
            } catch (Exception $e)
            {
                // TODO 
            }
        }
    }

}

?>