Re: [ADMIN] Migration of log features from 7.4 to 8.0

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [ADMIN] Migration of log features from 7.4 to 8.0
Дата
Msg-id 200502122348.j1CNmIo02365@candle.pha.pa.us
обсуждение исходный текст
Список pgsql-patches
Sz�cs G�bor wrote:
> Dear Gurus,
>
> Please show me to the right manual/discussion if my questions are already
> answered/solved.
>
> 1. DEBUG message level separation:
>
> In v7.3 there were the annoying DEBUG messages Start/CloseTransactCommand.
> In v7.4 you could eliminate them from user DEBUG messages by logging from
>     DEBUG2 level.
> In v8.0.0rc4, they are back at DEBUG2 level.
>
> Is there a way to eliminate them AND keep user DEBUG messages (i.e.
> plpgsql's "RAISE DEBUG")

I looked at the plpgsql code and saw this:

                | K_DEBUG
                    {
                        $$ = DEBUG2;
                    }

I think that should be DEBUG1.  This was pushed to DEBUG2 from DEBUG1 in
7.4 because we moved GUC debug output from LOG to DEBUG1:

    date: 2003/05/27 17:49:47;  author: momjian;  state: Exp;  lines: +2 -2
    Make debug_ GUC varables output DEBUG1 rather than LOG, and mention in
    docs that CLIENT/LOG_MIN_MESSAGES now controls debug_* output location.
    Doc changes included.

I think because this is a plpgsql-specified output of DEBUG it makes
sense it should be DEBUG1 too.

The attached patch moves a plpgsql DEBUG to DEBUG1.  It also fixes a few
place where DEBUG1 usage has crept in that should be DEBUG2. This will
be in 8.1

> 2. CONTEXTs and HINTs
>
> Looked up all the lines in postgresql.conf, but couldn't find the one to
> turn CONTEXT and HINT lines after notices or errors. They proved to be very
> useful, but can't make them be logged in v8. Is there a way?

Sure:

    log_error_verbosity = default  # terse, default, or verbose messages

>
> 3. redirect_stderr bogus?
>
> Activating redirect_stderr, setting log_dir, log_file and all the rotate
> params, it looked to me that all output the logger produced were 'db system
> ready' and 'shut down', and not even these lines appeared in the log file.
> May it be a bug, or simply the fact that a nonempty file already existed
> (from redirected stdout, as described above)<

Sorry, I am confused on how to answer this.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/access/transam/slru.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/slru.c,v
retrieving revision 1.23
diff -c -c -r1.23 slru.c
*** src/backend/access/transam/slru.c    31 Dec 2004 21:59:29 -0000    1.23
--- src/backend/access/transam/slru.c    12 Feb 2005 23:41:53 -0000
***************
*** 944,950 ****
                  if (doDeletions)
                  {
                      snprintf(path, MAXPGPATH, "%s/%s", ctl->Dir, clde->d_name);
!                     ereport(DEBUG1,
                              (errmsg("removing file \"%s\"", path)));
                      unlink(path);
                  }
--- 944,950 ----
                  if (doDeletions)
                  {
                      snprintf(path, MAXPGPATH, "%s/%s", ctl->Dir, clde->d_name);
!                     ereport(DEBUG2,
                              (errmsg("removing file \"%s\"", path)));
                      unlink(path);
                  }
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.180
diff -c -c -r1.180 xlog.c
*** src/backend/access/transam/xlog.c    31 Dec 2004 21:59:30 -0000    1.180
--- src/backend/access/transam/xlog.c    12 Feb 2005 23:41:57 -0000
***************
*** 2065,2071 ****
       * restore, or because the administrator has specified the restore
       * program incorrectly.  We have to assume the former.
       */
!     ereport(DEBUG1,
           (errmsg("could not restore file \"%s\" from archive: return code %d",
                   xlogfname, rc)));

--- 2065,2071 ----
       * restore, or because the administrator has specified the restore
       * program incorrectly.  We have to assume the former.
       */
!     ereport(DEBUG2,
           (errmsg("could not restore file \"%s\" from archive: return code %d",
                   xlogfname, rc)));

***************
*** 4893,4899 ****
      END_CRIT_SECTION();

      if (!shutdown)
!         ereport(DEBUG1,
                  (errmsg("checkpoint starting")));

      CheckPointCLOG();
--- 4893,4899 ----
      END_CRIT_SECTION();

      if (!shutdown)
!         ereport(DEBUG2,
                  (errmsg("checkpoint starting")));

      CheckPointCLOG();
***************
*** 4994,5000 ****
          TruncateSUBTRANS(GetOldestXmin(true));

      if (!shutdown)
!         ereport(DEBUG1,
                  (errmsg("checkpoint complete; %d transaction log file(s) added, %d removed, %d recycled",
                          nsegsadded, nsegsremoved, nsegsrecycled)));

--- 4994,5000 ----
          TruncateSUBTRANS(GetOldestXmin(true));

      if (!shutdown)
!         ereport(DEBUG2,
                  (errmsg("checkpoint complete; %d transaction log file(s) added, %d removed, %d recycled",
                          nsegsadded, nsegsremoved, nsegsrecycled)));

Index: src/backend/libpq/hba.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/libpq/hba.c,v
retrieving revision 1.136
diff -c -c -r1.136 hba.c
*** src/backend/libpq/hba.c    31 Dec 2004 21:59:50 -0000    1.136
--- src/backend/libpq/hba.c    12 Feb 2005 23:41:58 -0000
***************
*** 1640,1646 ****
              return STATUS_ERROR;
      }

!     ereport(DEBUG1,
              (errmsg("Ident protocol identifies remote user as \"%s\"",
                      ident_user)));

--- 1640,1646 ----
              return STATUS_ERROR;
      }

!     ereport(DEBUG2,
              (errmsg("Ident protocol identifies remote user as \"%s\"",
                      ident_user)));


В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Errno checks for rmtree()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Errno checks for rmtree()