开发者

Tomcat 7 log content of effective web.xml

This is probably obvious, but I can't find any details on it. After watching a video on tomcat 7, it was mentioned that it was possible to log the final web.xml after all the annotations in a web app had been processed. At this point, you could set metadata-complete to true and use the web.xml for production, thus improving performance. I've ran a quick test on an annotated servlet and I've not seen any generated web.xml in the logs (or anywhere el开发者_运维知识库se for that matter). I guess I'm missing something. Anyone managed to do this?


Ok,

I've found the answer, I seemed to miss this in the docs:

logEffectiveWebXml - Set to true if you want the effective web.xml used for a web application to be logged (at INFO level) when the application starts. The effective web.xml is the result of combining the application's web.xml with any defaults configured by Tomcat and any web-fragment.xml files and annotations discovered. If not specified, the default value of false is used.

So, it's a case of defining a context and setting this attribute to true. I'll take it for a spin and let you know how I get on.


Are you trying to see what is in that file? Or just know when it is started? If the latter then you can implement ServletContextListener and log whatever you need to see there. This is also where you can initialize and/or destroy an app configs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜