From: | "Dave Cramer" <dave(at)fastcrypt(dot)com> |
---|---|
To: | "'Philip Crotwell'" <crotwell(at)seis(dot)sc(dot)edu> |
Cc: | "'Barry Lind'" <barry(at)xythos(dot)com>, <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Driver Logging |
Date: | 2001-10-30 20:10:54 |
Message-ID: | 006801c1617e$fb4262d0$c201a8c0@inspiron |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Philip,
Yes this works! Thanks for the help,
Dave
-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Philip Crotwell
Sent: October 30, 2001 1:35 PM
To: Dave Cramer
Cc: 'Barry Lind'; pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Driver Logging
Hi
I think the problem is that the property file isn't inside a
"package"???
One thing I often do with log4j properties is put the props file inside
the jar within the same directory as the other .class files, ie in
org/postgresql/. Then use a snippet of code like:
props.load((org.postgresql.Driver.class).getClassLoader().getResourceAsS
tream(
"org/postgresql/postgresql_jdbc.props" ));
That way you are using the same ClassLoader that loaded the
org.postgresql.Driver class.
Maybe helps???
PHilip
On Tue, 30 Oct 2001, Dave Cramer wrote:
> I have been experimenting with adding logging to the driver.
>
> I think it was Gunnar that suggested that I try using log4j. I am
> running into a number of difficulties with this and would like to
> throw them out to see if there are some solutions.
>
> 1) configuring log4j requires an external file to be read, or
> configuration inside the driver at startup time. I have tried putting
> the configuration file log4j.properties into the jar and letting log4j
> initialize itself. This didn't work; it seems the default
> Classloader.getSystemResource("log4j.properties") doesn't find it
> inside the jar?? So I wrote a little code to get it as a resource
> bundle much like the error messages. This worked fine for things that
> load the driver in the usual manner, but then while debugging druid, I
> found that it doesn't load the driver in the "usual" manner but
> instead uses the JarClassLoader. For some reason log4j didn't get
> initialized properly. I am sure I can figure out a way around this,
> but I'm not sure I want to pursue the log4j option much further.
>
> 2)Perceived problems with log4j:
>
> a)we will have to ship another jar with the code.
> b)the log4j.properties file has to be placed somewhere on the
> filesystem and I'm not sure yet where that should be. It may turn out
> that depending on your application the property file has to be
> somewhere different.
> c) I think due to a and b above we are going to make it more
> difficult for new users to get the driver up and running
>
> At this point I am thinking about how to make it default to log
> nothing, and then provide properties for the driver to turn on
> selective logging. My biggest concern is requiring the installation of
> another jar, and the associated problems building the driver
>
> Any suggestions are welcome,
>
> Dave
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly
From | Date | Subject | |
---|---|---|---|
Next Message | Nick Fankhauser | 2001-10-30 20:52:09 | Re: Something unusual has occured to cause the driver to fail |
Previous Message | Jason Davies | 2001-10-30 19:24:13 | Re: SQL-Statement is too long |