Loggin SQL warnings in JDBC driver

Поиск
Список
Период
Сортировка
Искать
От
Edson Richter
Тема
Loggin SQL warnings in JDBC driver
Дата
Msg-id
BLU0-SMTP1153C57A744EA6503D03CE3CF130@phx.gbl
Список
I've applyied both paths below to be able to print SQL Warnings when 
loglevel=1 when working with JDBC 9.2.2 driver.
I did create this as separate driver compilation, because I don't want 
the slowdown introduced in the addWarnings (that would affect 
significantly my production servers).
Using this patch it is possible to get logged the RAISE NOTICE warnings 
from triggers, among other warnings.


First patch:
---------------------------------------------------------------------------------------------------------------------------

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- AbstractJdbc2Statement.java (Nov 14, 2012 9:08:49 
AM)
+++ Current File
@@ -745,6 +745,10 @@
       */
      public void addWarning(SQLWarning warn)
      {
+      if(connection.getLogger()!=null) {
+        connection.getLogger().log("Warning", warn);
+      }
+
          if (warnings == null) {
              warnings = warn;
              lastWarning = warn;

---------------------------------------------------------------------------------------------------------------------------


Second patch:
---------------------------------------------------------------------------------------------------------------------------

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- AbstractJdbc2Connection.java (Nov 14, 2012 9:08:49 
AM)
+++ Current File
@@ -327,6 +327,9 @@
       */
      public void addWarning(SQLWarning warn)
      {
+        if(getLogger()!=null) {
+          getLogger().log("Warning", warn);
+        }
          // Add the warning to the chain
          if (firstWarning != null)
              firstWarning.setNextWarning(warn);

---------------------------------------------------------------------------------------------------------------------------


Regards,

Edson

В списке pgsql-general по дате отправления
От: Kirk Wythers
Дата:
От: Kevin Grittner
Дата:
Сообщение: Re: SELECT DISTINCT
FAQ