agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Re: Log4j
Date: Thu, 06 Jan 2005 12:10:12 +0100
Message-ID: <thhal-0FrW4Am3rcS4LU1lRX2I78N0+NNi8cN@mailblocks.com> (raw)
In-Reply-To: <5F4ED4205E00D6119BFE009027DE39090793EFEF@MLSW00103>
References: <5F4ED4205E00D6119BFE009027DE39090793EFEF@MLSW00103>
<41DD1C94.7060506@mailblocks.com>
<thhal-0FrW4AmvrcS43xCnKDiVxkc14dtcoa3@mailblocks.com>
Nageshwar,
>Hi,
>
>I am trying use log4j logging as part of my code,
>I install log4j jar,
>while executing following error message is displayed
>
>"log4j:WARN No appenders could be found for logger
>(com.ge.gis.pgtrigger.EventTrigger).
>log4j:WARN Please initialize the log4j system properly."
>
>Basically it is not able to find log4j.properties file.
>
>
log4j needs a properties file that it can find in the classpath. You'll
need to include such a file in a jar that you load using
sqlj.install_jar. Personally, I'd refrain from using log4j since the JRE
is bundled with a good logging package. Adding yet another (fairly
extensive) logging package will waste resources.
>We tried using Logger.getAnonymousLogger() also, but couldn't locate the
>package for this.
>
>
The Logger is in java.util.logging. It's bundled with the java runtime.
The PLJava router for this can be found in
org.postgresql.pljava.internal. It's setup automatically by the PLJava
runtime.
PLJava will route logs printed using the java.util.logging.Logger to the
PostgreSQL elog mechanism. That in turn, will produce a logfile
somewhere (depends on your PostgreSQL configuration).
The mapping of log levels between Java and the PostgreSQL elog handler
is as follows (exerpt from org.postgresql.pljava.internal.ELogHandler):
if(level == null)
pgLevel = LOG_LOG;
else if(level.equals(Level.SEVERE))
pgLevel = LOG_ERROR;
else if(level.equals(Level.WARNING))
pgLevel = LOG_WARNING;
else if(level.equals(Level.INFO))
pgLevel = LOG_INFO;
else if(level.equals(Level.FINE))
pgLevel = LOG_DEBUG1;
else if(level.equals(Level.FINER))
pgLevel = LOG_DEBUG2;
else if(level.equals(Level.FINEST))
pgLevel = LOG_DEBUG3;
else
pgLevel = LOG_LOG;
I'd appreciate if you could send future questions to the
pljava-dev at gborg.postgresql.org instead of to me personally. The idea of
open source is better honored that way. Everyone can see all questions
and benefit from all replies. Another important aspect of this is that
all invovled have a chance to reply and convey their experiences.
Kind regards,
Thomas Hallgren
Message-ID: <thhal-0FrW4Am3rcS4LU1lRX2I78N0+NNi8cN@mailblocks.com>
Permalink: ../thhal-0FrW4Am3rcS4LU1lRX2I78N0+NNi8cN@mailblocks.com/
Also on: postgresql.org/message-id/thhal-0FrW4Am3rcS4LU1lRX2I78N0+NNi8cN@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: Log4j
In-Reply-To: <thhal-0FrW4Am3rcS4LU1lRX2I78N0+NNi8cN@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