From fde9e92da9e4f3864a9ad331a4ede4d5f250a1e2 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 15 Sep 2015 11:27:23 +0200 Subject: [PATCH] Use error_log with exception to log getTraceAsString --- include/class/class_acc_ledger_purchase.php | 2 +- include/class/class_anc_key.php | 2 +- include/class/class_default_menu.php | 3 ++- include/class/class_stock_goods.php | 5 +++-- include/lib/class_database.php | 1 + include/param_sec.inc.php | 3 ++- include/profile.inc.php | 6 ++++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/class/class_acc_ledger_purchase.php b/include/class/class_acc_ledger_purchase.php index 716303e1f..f057f4252 100644 --- a/include/class/class_acc_ledger_purchase.php +++ b/include/class/class_acc_ledger_purchase.php @@ -908,7 +908,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger echo ''. 'Erreur dans l\'enregistrement '. __FILE__.':'.__LINE__.' '. - $e->getMessage().$e->getTraceAsString(); + $e->getMessage().$e->getMessage(); error_log($e->getMessage()); $this->db->rollback(); throw new Exception($e); diff --git a/include/class/class_anc_key.php b/include/class/class_anc_key.php index aef741f1e..a1a99a2cd 100644 --- a/include/class/class_anc_key.php +++ b/include/class/class_anc_key.php @@ -265,7 +265,7 @@ class Anc_Key } catch (Exception $e) { - if ( DEBUG ) { echo $e->getTraceAsString(); } else { echo _('erreur');} + if ( DEBUG ) { echo $e->getTraceAsString(); } else { echo _('erreur').$e->getMessage();} error_log($e->getTraceAsString()); $cn->rollback(); } diff --git a/include/class/class_default_menu.php b/include/class/class_default_menu.php index 7aa595d9d..1419bb43b 100644 --- a/include/class/class_default_menu.php +++ b/include/class/class_default_menu.php @@ -106,7 +106,8 @@ class Default_Menu } } catch (Exception $e) { - $e->getTraceAsString(); + error_log($e->getTraceAsString()); + echo $e->getMessage(); throw $e; } } diff --git a/include/class/class_stock_goods.php b/include/class/class_stock_goods.php index cfbd681fe..96a817ad3 100644 --- a/include/class/class_stock_goods.php +++ b/include/class/class_stock_goods.php @@ -165,8 +165,9 @@ class Stock_Goods extends Stock_Goods_Sql } catch (Exception $exc) { - echo $exc->getTraceAsString(); - throw $exc; + error_log( $exc->getTraceAsString()); + echo $exc->getMessage(); + throw $exc; } } /** diff --git a/include/lib/class_database.php b/include/lib/class_database.php index 87ad5fac7..da167e19f 100644 --- a/include/lib/class_database.php +++ b/include/lib/class_database.php @@ -177,6 +177,7 @@ class Database echo $a->getTraceAsString(); echo pg_last_error($this->db); } + error_log($a->getTraceAsString()); $this->rollback(); throw ($a); diff --git a/include/param_sec.inc.php b/include/param_sec.inc.php index bc8b52e40..1149df147 100644 --- a/include/param_sec.inc.php +++ b/include/param_sec.inc.php @@ -182,7 +182,8 @@ if ( isset($_POST['ok'])) } // end try catch (Exception $e) { - echo_warning ($e->getTraceAsString()); + echo_warning ($e->getMessage()); + error_log($e->getTraceAsString()); $cn->rollback(); } diff --git a/include/profile.inc.php b/include/profile.inc.php index e590df642..eb5a38879 100644 --- a/include/profile.inc.php +++ b/include/profile.inc.php @@ -57,7 +57,8 @@ if (isset($_POST['change_profile'])) } catch (Exception $exc) { - echo $exc->getTraceAsString(); + echo $exc->getMessage(); + error_log( $exc->getTraceAsString()); throw $exc; } } @@ -95,7 +96,8 @@ if (isset($_POST['change_stock'])) } catch (Exception $exc) { - echo $exc->getTraceAsString(); + echo $exc->getMessage(); + error_log($exc->getTraceAsString()); throw $exc; } }