This modification to distribution configurations will expose Tomcat logs over HTTP through Tomcat DefaultServlet services. Confirmed by Tomcat 7.0.56, 8.0.24 distributions.
For this example, the Tomcat canonical distribution is provided for unpacking in / opt / tomcat.
In /opt/tomcat/conf/Catalina/localhost create a logs.xml file with this content:
<Context override = "true" docBase = "/ opt / tomcat / logs" path = "/ logs" />
Restart Tomcat. Find the log file that you know exists, for example
- local: 8080 / logs /catalina.out
If you also want to see a list of logs, suggest this additional configuration change.
Edit /opt/tomcat/conf/web.xml . If the listings parameter is configured, enable it by setting it to true :
...
& L; servlet>
...
<INIT pairs>
<pairs name-> lists <vapor-name and / GT;
<pair-value> <strong> true </pair-value>
</ Init pairs>
...
Restart tomcat for the change to take effect. Expect to see a list of log files as interactive links when conducting this test in a browser
- local: 8080 / magazines /
These options are probably undesirable for some production environments due to security issues or performance / resource utilization.
In some ways, rephrasing this item: The easiest way to serve static data outside the application server in a Java web application
Read more (at the ragged edges of this question)
And always useful documents
source share