agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Re: Raise "NOTICE" with pljava
Date: Wed, 11 May 2005 16:36:39 +0200
Message-ID: <42821877.6050101@mailblocks.com> (raw)
In-Reply-To: <d5qtfa$d56$1@sea.gmane.org>
References: <d5qtfa$d56$1@sea.gmane.org>

Marek Lewczuk wrote:
> Hello,
> In plpgsql we can raise "notice" with command "RAISE NOTICE" - I don't 
> see any build-in pljava methods to raise notice or I'm wrong ? I know 
> that I can raise warning with standard SQLWarning object, but "warning" 
> is not equal to "notice". Very simple solution is to write e.g. 
> raiseNotice(varchar) method in plpgsql, but I would like to know if 
> there is any native method.
> 
Errors and messages are handled using the standard java.util.logging 
facility. PL/Java comes with a special logger that sits on top of the 
PostgreSQL error and message reporting system.

		Logger log = Logger.getAnonymousLogger();
		log.info("a message for level INFO");
		log.warning("a message for level WARNING");
		log.fine("a message for level DEBUG1");
		log.finer("a message for level DEBUG2");
		log.finest("a message for level DEBUG3");

Messages intended for level Error should not use the logger but instead 
throw an SQLException.

The mapping is hardcoded at present. You can use the internal Backend 
class directly although I cannot guarantee that it will be portable 
across versions. It's possible to write:

   Backend.log(ELogHandler.LOG_NOTICE, "a message for level NOTICE");

that is equivalient to RAISE NOTICE in PL/pgsql.

Regards,
Thomas Hallgren





view thread (3+ messages)  latest in thread

Message-ID: <42821877.6050101@mailblocks.com>
Permalink:  ../42821877.6050101@mailblocks.com/
Also on:    postgresql.org/message-id/42821877.6050101@mailblocks.com

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: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] Re: Raise "NOTICE" with pljava
  In-Reply-To: <42821877.6050101@mailblocks.com>

* 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