From: | thhal at mailblocks(dot)com (Thomas Hallgren) |
---|---|
To: | |
Subject: | [Pljava-dev] Re: Raise "NOTICE" with pljava |
Date: | 2005-05-11 14:36:39 |
Message-ID: | 42821877.6050101@mailblocks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Marek Lewczuk | 2005-05-11 15:00:26 | [Pljava-dev] Re: Raise "NOTICE" with pljava |
Previous Message | Marek Lewczuk | 2005-05-10 18:18:17 | [Pljava-dev] Raise "NOTICE" with pljava |