[logback-dev] Question about logback

stephen.t.chan at asia.bnpparibas.com stephen.t.chan at asia.bnpparibas.com
Thu Jun 7 10:24:14 CEST 2012


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,

        <appender name="DB" class="com.eqd.iprice.appender.DBAppender">
                <connectionSource class=
"ch.qos.logback.core.db.DriverManagerConnectionSource">
                <dataSource class="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


This message and any attachments (the "message") is
intended solely for the intended addressees and is confidential. 
If you receive this message in error,or are not the intended recipient(s), 
please delete it and any copies from your systems and immediately notify
the sender. Any unauthorized view, use that does not comply with its purpose, 
dissemination or disclosure, either whole or partial, is prohibited. Since the internet 
cannot guarantee the integrity of this message which may not be reliable, BNP PARIBAS 
(and its subsidiaries) shall not be liable for the message if modified, changed or falsified. 
Do not print this message unless it is necessary,consider the environment.

------------------------------------------------------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le "message") 
sont etablis a l'intention exclusive de ses destinataires et sont confidentiels.
Si vous recevez ce message par erreur ou s'il ne vous est pas destine,
merci de le detruire ainsi que toute copie de votre systeme et d'en avertir
immediatement l'expediteur. Toute lecture non autorisee, toute utilisation de 
ce message qui n'est pas conforme a sa destination, toute diffusion ou toute 
publication, totale ou partielle, est interdite. L'Internet ne permettant pas d'assurer
l'integrite de ce message electronique susceptible d'alteration, BNP Paribas 
(et ses filiales) decline(nt) toute responsabilite au titre de ce message dans l'hypothese
ou il aurait ete modifie, deforme ou falsifie. 
N'imprimez ce message que si necessaire, pensez a l'environnement.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20120607/596cc86a/attachment.html>


More information about the logback-dev mailing list