This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
As for your war file in your server, all of the application servers I'm familiar with redirect System.out to a log file in some way. (The log() method of the servlet class is a more standard way to do this, though.)
As for your idea of writing data to a file and reopening the file and so on, you're in the process of reinventing logging. Don't reinvent it, just use it.
If you can run the war file in either Netbeans or Eclipse, the output of the logging will go to a console window and, as a bonus, you can use the debugger (set break points to stop execution, examine variable values, etc.).
If you can open the log file in an editor; most modern editors will let you refresh the view when the file changes.
Finally, if you are on a Linux/Unix based server, the command tail -f logfile will give you a constant show of what is being written to the file in real time. the PowerShell command gc can be used for this on Windows, or tail commands are available for download.
Joined: Apr 11, 2005
Thanks for suggestions...
The server I use (at itanets.co.uk) is linux based, and I've managed to locate the absolute path of the J2EE console output.
This file can't be accessed when I log into the servers control panel to get into filesystem, or either when I use FTP to get into filesystem,
but I wrote a simple php file which will display the file, and one to clear the file, cause I see it has output going back several months.
So this is much better, but I also use logging in my web-app, such as for closing mysql connection:
I'm not sure where these logs are stored (locally or on web-server). Locally I use glassfish server3, and web-server use apache tomcat I think.
Any thoughts? Thanks