[logback-user] use property substitution for login credential in logback.xml from tomcat context.xml
ceki
ceki at qos.ch
Thu Jun 7 10:44:55 CEST 2012
Hello Stephen,
You've already posted this same question on logback-dev. Please do not
cross post. It's against etiquette.
Cheers,
--
Ceki
http://twitter.com/#!/ceki
On 07.06.2012 10:37, stephen.t.chan at asia.bnpparibas.com wrote:
> Hi all,
>
> I am running tomcat6 as http server and specify jdbc connection(with
> login credential) in context.xml.
> Besides, I have defined to use DBAppender in logback.xml to write log to
> database.
> My question is, instead of directly write the login credential in the
> logback.xml file,
> how to use property substitution to retrieve the credential from tomcat
> context.xml?
>
> for example,
>
> <appendername=/"DB"/class=/"com.eqd.iprice.appender.DBAppender"/>
> <connectionSourceclass=/"ch.qos.logback.core.db.DriverManagerConnectionSource"/>
>
> <dataSourceclass=/"javax.sql.DataSource"/>
> <driverClass>${driverClass}</driverClass>
> <url>${url}</url>
> <user>${username}</user>
> <password>${password}</password>
> </dataSource>
> </connectionSource>
> </appender>
>
> Those ${XXXX} are retrieved from tomcat context.xml .
>
> Thanks.
>
> Stephen
>
> http://mailman.qos.ch/mailman/listinfo/logback-user
More information about the Logback-user
mailing list