public function testConfigureWithEmptyIniFile()
 {
     $catchedException = null;
     try {
         Logger::configure('configurators/test2.properties');
         Logger::initialize();
         self::assertTrue(false);
     } catch (LoggerException $e) {
         $catchedException = $e;
     }
     self::assertNotNull($catchedException);
 }
 public function testUsage()
 {
     Logger::resetConfiguration();
     Logger::configure(dirname(__FILE__) . '/test4.properties');
     Logger::initialize();
     $logger = Logger::getRootLogger();
     ob_start();
     $logger->error(new Fruit3());
     $v = ob_get_contents();
     ob_end_clean();
     self::assertEquals("ERROR - test1,test2,test3\n", $v);
 }
Example #3
0
 /**
  * Initializes this logger.
  *
  * @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
  * @param array             $options    An array of options.
  */
 public function initialize($options = array())
 {
     parent::initialize($options);
     if (!isset($options['file_name'])) {
         throw new StartupInitParamsExceptionException(get_class($this), 'file_name');
     }
     //        if (!isset($options['u_file_name']))
     //        {
     //            throw new StartupInitParamsExceptionException(get_class($this), 'u_file_name');
     //        }
     if (!isset($options['format'])) {
         throw new StartupInitParamsExceptionException(get_class($this), 'format');
     }
     if (!isset($options['inner_format'])) {
         throw new StartupInitParamsExceptionException(get_class($this), 'inner_format');
     }
     $this->format = $options['format'];
     $this->inner_format = $options['inner_format'];
     $this->file_name = ConfigManager::bind()->getBaseDir() . '/log/' . $options['file_name'];
     $this->u_file_name = ConfigManager::bind()->getBaseDir() . '/log/' . $options['u_file_name'];
     $this->event_dispatcher->connect('application.log_exception', array($this, 'ApplicationLogExceptionEventHandler'));
 }
 public function testRenderer()
 {
     Logger::configure('configurators/test4.properties');
     Logger::initialize();
     $hierarchy = Logger::getHierarchy();
     $map = $hierarchy->getRendererMap();
     $clazz = $map->getByClassName('Fruit');
     self::assertTrue($clazz instanceof FruitRenderer);
 }
Example #5
0
 public function testGetCurrentLoggers()
 {
     Logger::clear();
     Logger::resetConfiguration();
     self::assertEquals(0, count(Logger::getCurrentLoggers()));
     Logger::configure('LoggerTest.properties');
     Logger::initialize();
     self::assertEquals(1, count(Logger::getCurrentLoggers()));
     $list = Logger::getCurrentLoggers();
     self::assertEquals('mylogger', $list[0]->getName());
 }
Example #6
0
 /**
  * Initializes this logger.
  *
  * @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
  * @param array             $options    An array of options.
  */
 public function initialize($options = array())
 {
     parent::initialize($options);
     $this->event_dispatcher->connect('webbot.log', array($this, 'ConsoleLogEventHandler'));
 }
Example #7
0
$define('APP_FAILED_LOGIN_BACKOFF_MINUTES', 15);
$define('APP_HIDE_CLOSED_STATS_COOKIE', 'eventum_hide_closed_stats');
// if set, normal calls to eventum are redirected to a maintenance page while
// requests to /manage/ still work
$define('APP_MAINTENANCE', false);
require_once APP_PATH . '/autoload.php';
// fix magic_quote_gpc'ed values
if (get_magic_quotes_gpc()) {
    $_GET = Misc::dispelMagicQuotes($_GET);
    $_POST = Misc::dispelMagicQuotes($_POST);
    $_REQUEST = Misc::dispelMagicQuotes($_REQUEST);
}
Misc::stripInput($_POST);
// set default timezone
date_default_timezone_set(APP_DEFAULT_TIMEZONE);
Logger::initialize();
Language::setup();
// set charset
header('Content-Type: text/html; charset=' . APP_CHARSET);
// display maintenance message if requested.
if (APP_MAINTENANCE) {
    $is_manage = strpos($_SERVER['PHP_SELF'], '/manage/') !== false;
    if (APP_MAINTENANCE && !$is_manage) {
        $tpl = new Template_Helper();
        $tpl->setTemplate("maintenance.tpl.html");
        $tpl->displayTemplate();
        exit(0);
    }
}
// Default IRC category
$define("APP_EVENTUM_IRC_CATEGORY_DEFAULT", "default");
Example #8
0
 /**
  * Initializes this logger.
  *
  * @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
  * @param array             $options    An array of options.
  */
 public function initialize($options = array())
 {
     parent::initialize($options);
     $this->event_dispatcher->connect('webbot.log', array($this, 'WebbotLogEventHandler'));
     $this->event_dispatcher->connect('context.webbot_injected', array($this, 'ContextWebbotInjectedEventHandler'));
 }