From: thhal at mailblocks.com (Thomas Hallgren) Date: Wed, 11 May 2005 16:36:39 +0200 Subject: [Pljava-dev] Re: Raise "NOTICE" with pljava In-Reply-To: References: Message-ID: <42821877.6050101@mailblocks.com> 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