views:

312

answers:

3

Where can I view tomcat's log file in eclipse?

for some reason my tomcat's installation /log file is always empty.

BTW, does tomcat dump to the log file after a while or is it immediate?

+1  A: 

Go to the Servers view in eclipse then right click on the server and click Open. The log files are stored in a folder realative to the path in the 'Server path' field

royalsampler
the server path field says: .metadata\.plugins\org.eclipse.wst.server.core\tmp0 where is that?
Blankman
It refers to your workspace. In there you find a folder called .metadata and so on.
Nils Schmidt
ok found that folder thanks @Nils, but the /logs is still empty...
Blankman
are you using the tomcat that comes with eclipse or are you refering to a local intallation in your filesystem?
Nils Schmidt
local installation in my file system.
Blankman
okay. But you have configred it in eclipse and deploy your application by using eclipse? Do you see any log output in the console?To be honest, I am not sure where the problem hides. And I am kinda tired, already past mightnight, sorry, maybe I could have a look at it tomorrow.
Nils Schmidt
A: 

By default, Tomcat writes messages written to System.out and System.err to $CATALINA_HOME/log/catalina.out. (To help you find where $CATALINA_HOME, the $CATALINA_HOME/webapps directory is where your webapp should be installed.)

The System.out and System.err streams are not buffered, so any output should appear immediately in catalina.out.

If you are using a logging framework, then the destination of the logging messages depends on how you have configured logging for your webapp. If you haven't configured logging correctly, it is possible that your log messages are simply being dropped. AFAIK, different versions of Tomcat have different was of configuring logging, so refer to the version of the Tomcat documentation that is applicable.

As an experiment, add some traceprints to System.err to your webapp's initialization code, and check that they appear in "catalina.out".

Stephen C
A: 

Go to the Servers view in eclipse then right click on the server and click Open. The log files are stored in a folder realative to the path in the 'Server path' field

Since the path field is uneditable, you can also "Open Launch Configuration", click Arguments tab, copy the VM argument for catalina.base (within quotes). This is the full path of your WTP webapp directory. Copying the value to the clipboard can save you the laborious task of browsing the file system to the path.

Also note you should be seeing the output to the log file in your Console view as you run or debug.

harschware
extended upon the initial answer provided by @royalsampler
harschware