diff options
| author | xue <> | 2006-01-29 05:06:04 +0000 | 
|---|---|---|
| committer | xue <> | 2006-01-29 05:06:04 +0000 | 
| commit | 8c89c21a89c114624ab20a8f48c304f0de3727b0 (patch) | |
| tree | cadaf3b6767b2fc7fd9d5bc8d5360e9e34fd7ccf | |
| parent | 397f1f02d104a08321e9500aa65e83e5b3d22c4e (diff) | |
LogRoutes now work when errors happen during application running.
| -rw-r--r-- | demos/personal/protected/Pages/Home.page | 2 | ||||
| -rw-r--r-- | demos/personal/protected/application.xml | 4 | ||||
| -rw-r--r-- | framework/Exceptions/TErrorHandler.php | 2 | ||||
| -rw-r--r-- | framework/Exceptions/templates/exception-en.html | 2 | ||||
| -rw-r--r-- | framework/Exceptions/templates/exception-fr.html | 2 | ||||
| -rw-r--r-- | framework/Exceptions/templates/exception-zh.html | 4 | ||||
| -rw-r--r-- | framework/Exceptions/templates/exception.html | 2 | ||||
| -rw-r--r-- | framework/Log/TLogRouter.php | 22 | ||||
| -rw-r--r-- | framework/TApplication.php | 7 | 
9 files changed, 25 insertions, 22 deletions
| diff --git a/demos/personal/protected/Pages/Home.page b/demos/personal/protected/Pages/Home.page index 9471a9b9..204d4c6f 100644 --- a/demos/personal/protected/Pages/Home.page +++ b/demos/personal/protected/Pages/Home.page @@ -1,3 +1,3 @@ -<com:TContent ID="main" >
 +<com:TContent ID="main">
  main content
  </com:TContent>
\ No newline at end of file diff --git a/demos/personal/protected/application.xml b/demos/personal/protected/application.xml index 84467e98..28da6696 100644 --- a/demos/personal/protected/application.xml +++ b/demos/personal/protected/application.xml @@ -8,8 +8,8 @@      -->
      <module id="session" class="THttpSession" />
      <module id="log" class="System.Log.TLogRouter">
 -      <route class="TBrowserLogRoute" Categories="System.Web.UI.TPage" />
 -      <route class="TFileLogRoute" Categories="System.Web.UI.TPage" />
 +      <route class="TBrowserLogRoute" Categories="System.TApplication,System.Web.UI.TPage" />
 +      <route class="TFileLogRoute" Categories="System" Levels="Notice,Warning,Error,Alert,Fatal" />
      </module>
    </modules>
    <services>
 diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index fec4ce00..682de231 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -135,7 +135,7 @@ class TErrorHandler extends TModule  			else
  				$this->handleExternalError(500,$param);
  		}
 -		exit(1);
 +//		exit(1);
  	}
  	/**
 diff --git a/framework/Exceptions/templates/exception-en.html b/framework/Exceptions/templates/exception-en.html index c087792f..f9012206 100644 --- a/framework/Exceptions/templates/exception-en.html +++ b/framework/Exceptions/templates/exception-en.html @@ -12,7 +12,7 @@ h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }  h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
  h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
  p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
 -code,pre {font-family:"Lucida Console";}
 +code,pre {font-family:"Lucida Console";font-size:10pt;}
  td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
  .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}
  .error {background-color: #ffeeee;}/*]]>*/
 diff --git a/framework/Exceptions/templates/exception-fr.html b/framework/Exceptions/templates/exception-fr.html index ee41571c..993ef39e 100644 --- a/framework/Exceptions/templates/exception-fr.html +++ b/framework/Exceptions/templates/exception-fr.html @@ -11,7 +11,7 @@ h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }  h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
  h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
  p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
 -code,pre {font-family:"Lucida Console";}
 +code,pre {font-family:"Lucida Console";font-size:10pt;}
  td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
  .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}
  .error {background-color: #ffeeee;}
 diff --git a/framework/Exceptions/templates/exception-zh.html b/framework/Exceptions/templates/exception-zh.html index e4c8cbcc..ddfe9473 100644 --- a/framework/Exceptions/templates/exception-zh.html +++ b/framework/Exceptions/templates/exception-zh.html @@ -1,4 +1,4 @@ -<!DOCTYPE html PUBLIC
 +<!DOCTYPE html PUBLIC
  	"-//W3C//DTD XHTML 1.0 Transitional//EN"
  	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
 @@ -12,7 +12,7 @@ h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }  h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
  h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
  p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
 -code,pre {font-family:"Lucida Console";}
 +code,pre {font-family:"Lucida Console";font-size:10pt;}
  td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
  .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}
  .error {background-color: #ffeeee;}
 diff --git a/framework/Exceptions/templates/exception.html b/framework/Exceptions/templates/exception.html index c087792f..f9012206 100644 --- a/framework/Exceptions/templates/exception.html +++ b/framework/Exceptions/templates/exception.html @@ -12,7 +12,7 @@ h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }  h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
  h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
  p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
 -code,pre {font-family:"Lucida Console";}
 +code,pre {font-family:"Lucida Console";font-size:10pt;}
  td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
  .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}
  .error {background-color: #ffeeee;}/*]]>*/
 diff --git a/framework/Log/TLogRouter.php b/framework/Log/TLogRouter.php index 3292c4d3..ef16cb67 100644 --- a/framework/Log/TLogRouter.php +++ b/framework/Log/TLogRouter.php @@ -68,7 +68,7 @@ class TLogRouter extends TModule  				throw new TConfigurationException('logrouter_configfile_invalid',$this->_configFile);
  		}
  		$this->loadConfig($config);
 -		//$this->getApplication()->attachEventHandler('OnError',array($this,'collectLogs'));
 +		$this->getApplication()->attachEventHandler('OnError',array($this,'collectLogs'));
  		$this->getApplication()->attachEventHandler('OnEndRequest',array($this,'collectLogs'));
  	}
 @@ -158,6 +158,7 @@ abstract class TLogRoute extends TComponent  		TLogger::INFO=>'Info',
  		TLogger::NOTICE=>'Notice',
  		TLogger::WARNING=>'Warning',
 +		TLogger::ERROR=>'Error',
  		TLogger::ALERT=>'Alert',
  		TLogger::FATAL=>'Fatal'
  	);
 @@ -169,6 +170,7 @@ abstract class TLogRoute extends TComponent  		'info'=>TLogger::INFO,
  		'notice'=>TLogger::NOTICE,
  		'warning'=>TLogger::WARNING,
 +		'error'=>TLogger::ERROR,
  		'alert'=>TLogger::ALERT,
  		'fatal'=>TLogger::FATAL
  	);
 @@ -200,7 +202,7 @@ abstract class TLogRoute extends TComponent  	/**
  	 * @param integer|string integer log level filter (in bits). If the value is
  	 * a string, it is assumed to be comma-separated level names. Valid level names
 -	 * include 'Error', 'Debug', 'Info', 'Notice', 'Warning', 'Error', 'Alert' and 'Fatal'.
 +	 * include 'Debug', 'Info', 'Notice', 'Warning', 'Error', 'Alert' and 'Fatal'.
  	 */
  	public function setLevels($levels)
  	{
 @@ -604,10 +606,11 @@ class TBrowserLogRoute extends TLogRoute  		$string = <<<EOD
  <table cellspacing="0" cellpadding="0" border="0" width="100%">
  	<tr>
 -		<th style="background-color: black; color:white;" colspan="10">
 +		<th style="background-color: black; color:white;" colspan="11">
  			<h3>Trace Information: $category</h3>
  		</th>
  	</tr><tr style="background-color: #ccc;">
 +	    <th> </th>
  		<th>Category</th><th>Message</th><th>From First(s)</th><th>From Last(s)</th>
  	</tr>
  EOD;
 @@ -622,8 +625,8 @@ EOD;  		$color = $this->getColorLevel($log[1]);
  		$msg = preg_replace('/\(line[^\)]+\)$/','',$log[0]); //remove line number info
  		$string = <<<EOD
 -	<tr style="background-color: {$bgcolor}; color: {$color}">
 -		<td>{$log[2]}</td><td>{$msg}</td><td>{$total}</td><td>{$delta}</td>
 +	<tr style="background-color: {$bgcolor};">
 +		<td style="background-color: $color;"> </td><td>{$log[2]}</td><td>{$msg}</td><td>{$total}</td><td>{$delta}</td>
  	</tr>
  EOD;
  		return $string;
 @@ -635,16 +638,17 @@ EOD;  		{
  			case TLogger::DEBUG: return 'green';
  			case TLogger::INFO: return 'black';
 -			case TLogger::NOTICE: return 'blue';
 -			case TLogger::WARNING: return '#f63';
 -			case TLogger::ALERT: return '#c00';
 +			case TLogger::NOTICE: return '#3333FF';
 +			case TLogger::WARNING: return '#33FFFF';
 +			case TLogger::ERROR: return '#ff9933';
 +			case TLogger::ALERT: return '#ff00ff';
  			case TLogger::FATAL: return 'red';
  		}
  	}
  	protected function renderFooter()
  	{
 -		$string = "<tr><td colspan=\"10\" style=\"text-align:center; border-top: 1px solid #ccc; padding:0.2em;\">";
 +		$string = "<tr><td colspan=\"11\" style=\"text-align:center; border-top: 1px solid #ccc; padding:0.2em;\">";
  		foreach(self::$_levelValues as $name => $level)
  		{
  			$string .= "<span style=\"color:".$this->getColorLevel($level);
 diff --git a/framework/TApplication.php b/framework/TApplication.php index 80c55e44..5f5c519c 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -803,10 +803,9 @@ class TApplication extends TComponent  	 */  	public function onError($param)  	{ -		if($this->hasEventHandler('OnError')) -			$this->raiseEvent('OnError',$this,$param); -		else -			$this->getErrorHandler()->handleError($this,$param); +		Prado::log($param->getMessage(),TLogger::ERROR,'System.TApplication'); +		$this->getErrorHandler()->handleError($this,$param); +		$this->raiseEvent('OnError',$this,$param);  	}  	/** | 
