Обсуждение: Many "loaded library" logs by preload libraries

Поиск
Список
Период
Сортировка

Many "loaded library" logs by preload libraries

От
ITAGAKI Takahiro
Дата:
Hi,

If we set shared_preload_libraries or local_preload_libraries to
load some modules, "loaded library" messages are logged in server
log every new connections and autovacuum workers.
   LOG:  loaded library "pg_stat_statements"

Messages by shared_preload_libraries are logged only once
on non-EXEC_BACKEND platforms, but many times on Windows.
On the other hand, local_preload_libraries outputs logs
meny times in all platforms.

Is it too noisy? How about reducing the log level to DEBUG
and/or logging them only in postmaster?

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



Re: Many "loaded library" logs by preload libraries

От
Tom Lane
Дата:
ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> If we set shared_preload_libraries or local_preload_libraries to
> load some modules, "loaded library" messages are logged in server
> log every new connections and autovacuum workers.
>     LOG:  loaded library "pg_stat_statements"

Yeah, I was noticing that myself while testing pg_stat_statements.
I agree that we should fix it to reduce the message level for reloads
occurring in child processes.  I'd suggest using DEBUG2 if
(IsUnderPostmaster && process_shared_preload_libraries_in_progress).
I'm not so enthused about eliminating messaging for 
local_preload_libraries, though.
        regards, tom lane


Re: Many "loaded library" logs by preload libraries

От
Tom Lane
Дата:
ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah, I was noticing that myself while testing pg_stat_statements.
>> I agree that we should fix it to reduce the message level for reloads
>> occurring in child processes.  I'd suggest using DEBUG2 if
>> (IsUnderPostmaster && process_shared_preload_libraries_in_progress).
>> I'm not so enthused about eliminating messaging for 
>> local_preload_libraries, though.

> Here is a patch to do it.

Applied, thanks.
        regards, tom lane


Re: Many "loaded library" logs by preload libraries

От
ITAGAKI Takahiro
Дата:
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> > If we set shared_preload_libraries or local_preload_libraries to
> > load some modules, "loaded library" messages are logged in server
> > log every new connections and autovacuum workers.
> 
> Yeah, I was noticing that myself while testing pg_stat_statements.
> I agree that we should fix it to reduce the message level for reloads
> occurring in child processes.  I'd suggest using DEBUG2 if
> (IsUnderPostmaster && process_shared_preload_libraries_in_progress).
> I'm not so enthused about eliminating messaging for 
> local_preload_libraries, though.

Here is a patch to do it.

Index: src/backend/utils/init/miscinit.c
===================================================================
--- src/backend/utils/init/miscinit.c    (HEAD)
+++ src/backend/utils/init/miscinit.c    (fixed)
@@ -1146,6 +1146,7 @@    char       *rawstring;    List       *elemlist;    ListCell   *l;
+    int            elevel;    if (libraries == NULL || libraries[0] == '\0')        return;                    /*
nothingto do */
 
@@ -1166,6 +1167,11 @@        return;    }
+    if (IsUnderPostmaster && process_shared_preload_libraries_in_progress)
+        elevel = DEBUG2;
+    else
+        elevel = LOG;
+    foreach(l, elemlist)    {        char       *tok = (char *) lfirst(l);
@@ -1185,7 +1191,7 @@            filename = expanded;        }        load_file(filename, restricted);
-        ereport(LOG,
+        ereport(elevel,                (errmsg("loaded library \"%s\"", filename)));        pfree(filename);    }

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center