[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16746] save uncought exeptions to database log
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16746] save uncought exeptions to database log |
Date: |
Wed, 17 May 2017 13:50:33 -0400 (EDT) |
Revision: 16746
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16746
Author: sigurdne
Date: 2017-05-17 13:50:33 -0400 (Wed, 17 May 2017)
Log Message:
-----------
save uncought exeptions to database log
Modified Paths:
--------------
trunk/admin/inc/class.bolog.inc.php
trunk/phpgwapi/inc/class.log.inc.php
trunk/phpgwapi/inc/functions.inc.php
Modified: trunk/admin/inc/class.bolog.inc.php
===================================================================
--- trunk/admin/inc/class.bolog.inc.php 2017-05-17 17:49:27 UTC (rev 16745)
+++ trunk/admin/inc/class.bolog.inc.php 2017-05-17 17:50:33 UTC (rev 16746)
@@ -33,6 +33,12 @@
$_records = array();
$records = $this->so->list_log($account_id, $start,
$order, $sort);
+ if ( !isset($GLOBALS['phpgw']->log)
+ || !is_object($GLOBALS['phpgw']->log) )
+ {
+ $GLOBALS['phpgw']->log =
createObject('phpgwapi.log');
+ }
+ $log =& $GLOBALS['phpgw']->log;
foreach ( $records as $record )
{
// build and pass the format by hand as we want
to show the seconds
@@ -46,13 +52,13 @@
$record['log_account_lid'] = $t[0];
}
- $record['log_severity'] =
lang($GLOBALS['phpgw']->log->get_level_name($record['log_severity']));
+ $level_name =
$log->get_level_name($record['log_severity']);
$_records[] = array(
'log_date' =>
$record['log_date'],
'log_account_lid' =>
$record['log_account_lid'],
'log_app' =>
$record['log_app'],
- 'log_severity' =>
$record['log_severity'],
+ 'log_severity' =>
lang($level_name),
'log_file' =>
$record['log_file'],
'log_line' =>
$record['log_line'],
'log_msg' =>
$record['log_msg']
Modified: trunk/phpgwapi/inc/class.log.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.log.inc.php 2017-05-17 17:49:27 UTC (rev
16745)
+++ trunk/phpgwapi/inc/class.log.inc.php 2017-05-17 17:50:33 UTC (rev
16746)
@@ -88,6 +88,7 @@
function get_level_name($level)
{
+ $level = trim($level);
return $this->log_level_names[$level];
}
@@ -297,7 +298,7 @@
else
{
echo $message;
- $call_footer = true;
+ $call_footer = false;
}
// phpgwapi_cache::message_set($message, 'error');
Modified: trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- trunk/phpgwapi/inc/functions.inc.php 2017-05-17 17:49:27 UTC (rev
16745)
+++ trunk/phpgwapi/inc/functions.inc.php 2017-05-17 17:50:33 UTC (rev
16746)
@@ -421,6 +421,33 @@
*/
function phpgw_handle_exception($e)
{
+ if ( !isset($GLOBALS['phpgw']->log)
+ || !is_object($GLOBALS['phpgw']->log) )
+ {
+ $GLOBALS['phpgw']->log = createObject('phpgwapi.log');
+ }
+ $log =& $GLOBALS['phpgw']->log;
+
+// $log_args = array
+// (
+// 'file' => $e->getfile(),
+// 'line' => $e->getline(),
+// 'text' => "Uncaught Exception:\n". $e->getMessage() .
"\n" . $e->getTraceAsString(),
+// 'severity' => 'F'
+// );
+
+ if ($GLOBALS['phpgw']->db->get_transaction())
+ {
+ $GLOBALS['phpgw']->db->transaction_abort();
+ }
+
+// $log->fatal($log_args);
+
+ $log->error(array(
+ 'text' => "<b>Uncaught Exception:</b>\n".
$e->getMessage() . "\n" . $e->getTraceAsString(),
+ 'line' => $e->getline(),
+ 'file' => $e->getfile()
+ ));
$help = 'Please contact your administrator for assistance';
if (!ini_get('display_errors'))
@@ -428,6 +455,7 @@
echo <<<HTML
<h1>Uncaught Exception</h1>
<p>{$help}</p>
+ <p>Error is logged</p>
HTML;
exit;
}
@@ -438,6 +466,7 @@
echo <<<HTML
<h1>Uncaught Exception: {$msg}</h1>
<p>{$help}</p>
+ <p>Error is logged</p>
<h2>Backtrace:</h2>
<pre>
{$trace}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16746] save uncought exeptions to database log,
sigurdne <=