logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: JDBCAppender and DB passwords
Date Wed, 02 Apr 2008 16:13:11 GMT

There's a couple ways.  Both involve referencing variables set externally. 
 For instance...


You can make these variables available in one of two ways (only the first way 
below if you are using XML config)....

1.  Set it as a system property.  e.g...  java -Ddb.username=[username] 

2.  You can manually configure using the PropertyConfigurator and pass in 
variables prior to calling configure() (can't recall the exact API to do this 
at the moment, but you can look it up).

I have't worked with the JDBCAppender much.  I wonder if you couldn't just 
give it a JNDI name of the DataSource it is supposed to use?  In that case, 
the above would be unnecessary.


On Wed, 2 Apr 2008 23:37:27 +1100
  "Annie Lane" <annielaney@gmail.com> wrote:
> Hi list,
> I'm using log4j-1.2.14 and want to play with JDBCAppender. My main concern
> is the fact that in my log4j.properties file I need to provide the username
> and password details for the database connection.
> How can I use JDBCAppender without having to put this information in my
> .properties file?
> Additionally, how might I inject a database connection from within my
> application? Say I'm developing a JEE app which contains its own connection
> pooling mechanisms etc.
> Any help/advice would be very much appreciated.
> Annie

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message