简体   繁体   中英

Can JNDI be used by webapps to look up a logger?

We have multiple webapps running in our container (Tomcat 6/7) and each webapp configures its own application-specific logging (to different log files). There are certain events we need logged to a central log shared by all webapps.

We use JNDI to look up a datasource configured in Tomcat; is it possible to do the same thing with a logger, so when each web application starts it retrieves the shared container-level logger?

I would think it should be possible, though I have not tried it myself. The logger is a Java object and you can store any Java object in a store that JNDI is aware of and JNDI should be able to retrieve it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM