4

I installed Apache Tomcat 8.5.9 using Homebrew on macOS Sierra. When I start the Tomcat server, catalina.out is not created as expected in /usr/local/Cellar/tomcat/8.5.9/libexec/logs.

I have tried:

  • Redirecting the log file to another location using setenv.sh
  • echo "log file location $CATALINA_OUT" in /usr/local/Cellar/tomcat/8.5.9/bin/catalina and it is set to the default location of libexec/logs/catalina.out. After this change, I can see that setenv.sh is modifying this location correctly.
  • Manually creating catalina.out in the default location and granting full privileges

I am seeing other logs like:

  • catalina.[date].log
  • host-manager.[date].log
  • manager.[date].log
  • localhost_access_log.[date].log

The Tomcat server is running fine as in I am able to run my WAR files and use my applications with no problems. None of the other logs indicate a problem creating catalina.out, as I would expect.

JeredM
  • 897
  • 1
  • 14
  • 25
  • Check the permissions and owner of the folder in which catalina.out should be created – Nir Alfasi Jan 04 '17 at 19:17
  • I set them to 777 to test and still the file is not in place. Also, `ps aux | grep tomcat` shows that the user running the process is the folder owner. – JeredM Jan 04 '17 at 19:20
  • Possible duplicate of [There is no catalina.out](http://stackoverflow.com/questions/3491574/there-is-no-catalina-out) – Nir Alfasi Jan 04 '17 at 19:21
  • I don't think it is a duplicate as `>> "$CATALINA_OUT" 2>&1 "&"` is in the 8.5.9/bin/catalina file. The solution of `catalina run > ..\logs\catalina.out 2<&1` didn't seem to work either. – JeredM Jan 04 '17 at 19:27
  • read all the answers please, there is one which I suspect is relevant to your case – Nir Alfasi Jan 04 '17 at 19:32
  • Can you please be more specific about which answer you think my problem is solved by? It appears that the OP in that question gave up as the proposed solutions didn't work and used a different install on Windows. – JeredM Jan 04 '17 at 19:45
  • try this: http://stackoverflow.com/a/3491653/1057429 – Nir Alfasi Jan 04 '17 at 19:52
  • Thank you. I tried generating an error in my application. The error logs in my console, but catalina.out is not created. – JeredM Jan 04 '17 at 19:58

1 Answers1

2

It seems that Homebrew redirects stdout/stderr which overrides the configuration provided by Tomcat, and by default the configuration for the Tomcat installation in Homebrew does not define a file to log the standard output and error. You can change this by modifying the .plist file for Tomcat.

Find the .plist file in the base directory for the Tomcat installation. The installation was located in /usr/local/Cellar/tomcat@8/8.5.51 for me, but it may vary by Tomcat version. There should be a file in that directory named something similar to homebrew.mxcl.tomcat@8.plist. Edit that file and add the following lines to the <dict> element:

  <key>StandardOutputPath</key>
  <string>/path/to/catalina.out</string>
  <key>StandardErrorPath</key>
  <string>/path/to/catalina.out</string>

Be careful not to insert the lines between any existing key-value pairs.

I chose to use the catalina.out path Tomcat would have created by default which for me would be /usr/local/Cellar/tomcat@8/8.5.51/libexec/logs/catalina.out.

heisbrandon
  • 1,180
  • 7
  • 8