From: | Chapman Flack <chap(at)anastigmatix(dot)net> |
---|---|
To: | Kartik Ohri <kartikohri13(at)gmail(dot)com> |
Cc: | pljava-dev(at)lists(dot)postgresql(dot)org |
Subject: | Re: Starting build-system work (Windows/Mac users please speak up) |
Date: | 2020-05-31 16:00:08 |
Message-ID: | 5ED3D488.1010401@anastigmatix.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
On 05/30/20 10:42, Chapman Flack wrote:
> Diagnostic messages from Java code generally follow one of these paths:
>
> - they get explicitly sent to PostgreSQL's elog system, and go wherever
> the PostgreSQL logging is pointed, or suppressed depending on the
> enabled log level
>
> - Java exceptions caught and turned into PostgreSQL errors go into the
> PostgreSQL logs at level ERROR.
>
> - Separately, the stack traces of those exceptions are output if the
> PostgreSQL log level is set to DEBUG1 or finer. The code adjusts
> the vfprintf-hook log level (see below) to DEBUG1 before printing
> the stack trace, but I'm not positive it isn't just going to System.err
> and not through the hook. Should be easy enough to confirm, I just
> haven't had to before.
I've just confirmed this with gdb; an exception stack trace emitted
with printStackTrace [0] goes straight to System.err and the vfprintf hook
is not involved, so the surrounding calls to setJavaLogLevel aren't
really accomplishing anything.
> - Messages from the JVM itself that are emitted through a 'vfprintf hook'
> are caught by PL/Java's hook [1] and injected into PostgreSQL's
> elog system at a selectable level, usually INFO. (That is probably
> the path being followed by the -Xcheck:jni messages, explaining
> why they have INFO: in front.)
Confirmed also: -Xcheck:jni messages go through the vfprintf hook, so
they are always funneled into the PostgreSQL server log, regardless of
the setting of logging_collector.
> - Messages that are simply written to Java's System.err *can be* caught
> and included in PostgreSQL's logs, depending on PostgreSQL's
> logging_collector setting. [2] Otherwise, they just go wherever stderr
> was pointing when the PostgreSQL server was started (or wherever
> the server startup scripts point it). That could be, for example,
> the systemd journal.
-Chap
[0]
https://github.com/tada/pljava/blob/efbbc1d/pljava-so/src/main/c/JNICalls.c#L82
> [1]
> https://github.com/tada/pljava/blob/efbbc1d/pljava-so/src/main/c/Backend.c#L200
>
> [2]
> /docs/9.5/runtime-config-logging.html#GUC-LOGGING-COLLECTOR
From | Date | Subject | |
---|---|---|---|
Next Message | Chapman Flack | 2020-05-31 18:15:10 | Re: Starting build-system work (Windows/Mac users please speak up) |
Previous Message | Chapman Flack | 2020-05-30 19:16:35 | Java 14 "Helpful NullPointerExceptions" |