Tools for convenient viewing of Tomcat 7 logfiles

12,833

Solution 1

If you are looking for centralized log management take a look at logstash. Another solution is Octopussy.

Both tools can be configured so that you only see the logs of a specific server. Those tools are not Tomcat-specific, you can use them also for retrieving logs of your database server, web server etc.

Solution 2

Use a symbolic link to map the log file to a text file in the document root.

In Windows:

mklink %DOCUMENT_ROOT%/tomcat.txt %TOMCAT_LOGS%/tomcat.log

In *nix:

ln -s $TOMCAT_LOGS/tomcat.log $DOCUMENT_ROOT/tomcat.txt 

Open the log in the browser:

https://127.0.0.1/tomcat.txt

References

Share:
12,833
Glory to Russia
Author by

Glory to Russia

Updated on June 05, 2022

Comments

  • Glory to Russia
    Glory to Russia almost 2 years

    Is there any software (except Psi-Probe and Java Melody), which allows to look in the Tomcat files and is more comfortable than cat /var/log/tomcat7/catalina.out | tail | less ?

    Ideally, it would work like this: I launch the application (or open a web page) and immediately see current log file of Tomcat (without the need to open the SSH client, entering credentials etc.).

  • Juan Calero
    Juan Calero over 10 years
    The Windows version is wrong. The link file should be the first parameter, and the target file, the second one. Works great, anyway.
  • Paul Sweatte
    Paul Sweatte over 10 years
    @JuanCalero Fixed. Happy to help
  • sleske
    sleske almost 10 years
    Note that, if implemented like described, this will make your logs available without authentication. For a public-facing Tomcat, this is probably not what you want... though you can mitigate the problem, for example with a restrictive reverse proxy.
  • Sridhar Sarnobat
    Sridhar Sarnobat about 8 years
    The biggest disadvantage of this is that you have to refresh the page each time there is activity. But still, I like the creative solution :)
  • nix
    nix over 5 years
    soft link (ln -s ... ..) does not work on linux installed tomcat-8.x. Instead you should create hard link to catalina.out