I was just wondering where the java/tomcat console is hiding in OS X. I do use an OS X as well as a Windows machine for development. Both running the latest OS version, as well as the latest Cube Studio version. On the Windows machine a console window opens up as soon as I run an app from the Cuba studio. Under OS X this does not happen. While debugging and developing, some times I like to use the good old System.out.println() to print something on the console. So I’m wondering if I can enable the console on OS X as well.
By default we show terminal window with tomcat executable only on Windows. On another OS you can find tomcat logs in Studio.
If you want to show console window on Mac OS you can use special environment variable CUBA_TOMCAT_START_SCRIPT. This option is recommended only for users that are familiar with shell and scripting. On my Linux machine it is set to:
/home/artamonov/.scripts/tomcat-start.sh
And tomcat-start.sh opens new terminal window with catalina.sh (this script is relevant only for XFCE desktop on Linux):
Next I gave it a try and put some test script (echo-ing the parameters) in a script called by the script in the environment variable. The first should open a terminal and show the parameters. In the end of course it should start Tomact (startup.sh or catalina.sh in /deploy/tomcat/bin). But while the environment variable was set, it didn’t make any difference. Tomcat was started as usual by Cuba Studio.
For me though it’s not a big deal anymore since I discovered that the console output is written to /deploy/tomcat/logs/catalina.out.
So when debugging/developing while using the good old System.out.println to show me the values of certain variables, I can do so on my Mac too. I just will fire up a terminal and the tail command:
I hope this reply is still useful for someone, whether searching for how to set an environment variable on Mac OSX or a way to see the values printed to the console by System.out.println or alike.
Yes I did, and yes it shows the tomcat log and of course that’s useful. But unfortunately it does not show the catalina.out log. This is the log file that contains everything that was sent to std out (the console). Would be nice though, if that would be included.
We will check it and try to add to Studio. Also I recommend you debugging using Logger statements. Just inject Logger instance to your controller or bean and post messages: