Skip to content

Commit 49b5ee6

Browse files
committed
Merge pull request #96 from issei-m/sf-exception-log-level
changed log level of sfException to CRITICAL (excluding 404 error)
2 parents 5886be7 + 006d6ae commit 49b5ee6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

lib/exception/sfException.class.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This file is part of the symfony package.
55
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
66
* (c) 2004-2006 Sean Kerr <sean@code-box.org>
7-
*
7+
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
@@ -73,7 +73,7 @@ static public function clearLastException()
7373
{
7474
self::$lastException = null;
7575
}
76-
76+
7777
/**
7878
* Prints the stack trace for this exception.
7979
*/
@@ -137,7 +137,8 @@ static protected function outputStackTrace(Exception $exception)
137137

138138
if (sfConfig::get('sf_logging_enabled'))
139139
{
140-
$dispatcher->notify(new sfEvent($exception, 'application.log', array($exception->getMessage(), 'priority' => sfLogger::ERR)));
140+
$priority = $exception instanceof sfError404Exception ? sfLogger::ERR : sfLogger::CRIT;
141+
$dispatcher->notify(new sfEvent($exception, 'application.log', array($exception->getMessage(), 'priority' => $priority)));
141142
}
142143

143144
$event = $dispatcher->notifyUntil(new sfEvent($exception, 'application.throw_exception'));
@@ -195,9 +196,9 @@ static protected function outputStackTrace(Exception $exception)
195196
}
196197
}
197198

198-
// when using CLI, we force the format to be TXT. Compare exactly to
199-
// the string 'cli' because the php 5.4 server is identified by 'cli-server'
200-
if ('cli' == PHP_SAPI)
199+
// when using CLI, we force the format to be TXT. Compare exactly to
200+
// the string 'cli' because the php 5.4 server is identified by 'cli-server'
201+
if ('cli' == PHP_SAPI)
201202
{
202203
$format = 'txt';
203204
}
@@ -397,7 +398,7 @@ static protected function formatArgs($args, $single = false, $format = 'html')
397398
{
398399
$formattedValue = $value;
399400
}
400-
401+
401402
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", self::escape($key), $formattedValue);
402403
}
403404

@@ -406,12 +407,12 @@ static protected function formatArgs($args, $single = false, $format = 'html')
406407

407408
/**
408409
* Formats a file path.
409-
*
410+
*
410411
* @param string $file An absolute file path
411412
* @param integer $line The line number
412413
* @param string $format The output format (txt or html)
413414
* @param string $text Use this text for the link rather than the file path
414-
*
415+
*
415416
* @return string
416417
*/
417418
static protected function formatFile($file, $line, $format = 'html', $text = null)
@@ -443,7 +444,7 @@ static protected function escape($value)
443444
{
444445
return $value;
445446
}
446-
447+
447448
return htmlspecialchars($value, ENT_QUOTES, sfConfig::get('sf_charset', 'UTF-8'));
448449
}
449450
}

0 commit comments

Comments
 (0)