public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chapman Flack <[email protected]>
To: Kartik Ohri <[email protected]>
Cc: [email protected]
Subject: Re: Starting build-system work (Windows/Mac users please speak up)
Date: Sun, 31 May 2020 12:00:08 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CAASLQ4OdOma6h5Mu=hMEPyk0M4-MomYZLnhGH+2wVoL1vt_UEg@mail.gmail.com>
	<[email protected]>
	<CAASLQ4P11FFgefy_xK0Tcw3vWt1F1MNyVgK5eU=PFGvYrpZcyw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAASLQ4PAQ0PNAxJ5ad9U6o+RT2ip19FXvgoK2y1kGWaJbTZ1WQ@mail.gmail.com>
	<[email protected]>
	<CAASLQ4OXAb+_J=oK54PH5eYuXjkV9KMsoXEcp-TYaQPqxk1Xbg@mail.gmail.com>
	<[email protected]>

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]
> https://www.postgresql.org/docs/9.5/runtime-config-logging.html#GUC-LOGGING-COLLECTOR






view thread (47+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Starting build-system work (Windows/Mac users please speak up)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox