Tomcat displays expanded application name instead of war file

I have several applications deployed in tomcat 6 that are routed to different virtual hosts, so they all have separate context roots and are called ROOT.war. When tomcat lights up, in catalina.out I see this:

INFO: Deploying web application archive ROOT.war Feb 11, 2011 1:33:55 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ROOT.war Feb 11, 2011 1:33:56 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ROOT.war Feb 11, 2011 1:33:57 PM org.apache.catalina.startup.HostConfig deployWAR 

Application logs are routed to another place, and I can’t say which applications were deployed and in what order.

I want to see the application name from war.xml instead of ROOT.war. Does anyone know a way to do this without turning on debugging and cluttering the log?

+4
source share
1 answer

Tomcat does not support ordered webapp deployments (at least in versions 5-6) de jure. In fact, you can put links to various webapps in the desired order inside conf/server.xml , and this will (probably) work. This, however, can be classified as a hack. Another disadvantage of this approach is that you have to statically define things in server.xml .

Another alternative could be to create a separate DeploymentInfoLogger class (or any other) in every webapp that has static log initialization with the name of this class. Enable debugging level only for this class (so as not to load unnecessary log data). Set up appender the same as for catalina.out ( ConsoleAppender I suppose?). Make this class a context listener and register something meaningful during the launch of webapp. This, of course, is only possible if you know in advance that this webapp will serve a specific virtual host. If not, you can probably use some kind of native Tomcat API to determine this from the configuration.

SΔ—kmΔ—s :)

+2
source

Source: https://habr.com/ru/post/1339364/


All Articles