147

Where can I view Tomcat log files in Eclipse?

For some reason my Tomcat installation/log folder is always empty.

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

bluish
  • 26,356
  • 27
  • 122
  • 180
Blankman
  • 259,732
  • 324
  • 769
  • 1,199

8 Answers8

193

I'm not sure if you were after catalina.out or one of the other logs produced by Tomcat.

But, if you're after the catalina.out log file then follow the directions below:

  • In the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.

  • Click on "Open launch configuration". Click on the "Common" tab.

  • Towards the bottom of the screen you can check the "File" checkbox and then specify a file that can be used to log your console (catalina.out) output.

  • Finally, restart the Tomcat server.

dwjohnston
  • 11,163
  • 32
  • 99
  • 194
codesta
  • 1,931
  • 2
  • 11
  • 2
84

Go to the "Server" view, then double-click the Tomcat server you're running. The access log files are stored relative to the path in the "Server path" field, which itself is relative to the workspace path.

zb226
  • 9,586
  • 6
  • 49
  • 79
royalsampler
  • 1,195
  • 8
  • 4
  • 8
    the server path field says: .metadata\.plugins\org.eclipse.wst.server.core\tmp0 where is that? – Blankman Feb 09 '10 at 22:52
  • 11
    It refers to your workspace. In there you find a folder called .metadata and so on. – Nils Schmidt Feb 09 '10 at 23:08
  • are you using the tomcat that comes with eclipse or are you refering to a local intallation in your filesystem? – Nils Schmidt Feb 09 '10 at 23:15
  • local installation in my file system. – Blankman Feb 09 '10 at 23:20
  • 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 Feb 09 '10 at 23:24
  • 4
    This is the location of the Tomcat deployment, but not the log files. @codesta has the right answer. – SimplGy Feb 07 '12 at 23:30
  • I too have touch time finding logs in built-in tomcat on Eclipse. I can't even get the path to the tomcat home directory. Eclipse sucks!! – Gsv Nov 28 '14 at 09:40
  • @pongapundit it may put tomcat in C:/tomcat/logs or D:/tomcat/logs/ or something similar depending on your OS, this is probably a fallback mechanism – Christophe Roussy Mar 09 '15 at 13:37
22

Another forum provided this answer:

Ahh, figured this out. The following system properties need to be set, so that the "logging.properties" file can be picked up.

Assuming that the tomcat is located under an Eclipse project, add the following under the "Arguments" tab of its launch configuration:

-Dcatalina.base="${project_loc}\<apache-tomcat-5.5.23_loc>" 
-Dcatalina.home="${project_loc}\<apache-tomcat-5.5.23_loc>" 
-Djava.util.logging.config.file="${project_loc}\<apache-tomcat-5.5.23_loc>\conf\logging.properties" 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 

http://www.coderanch.com/t/442412/Tomcat/Tweaking-tomcat-logging-properties-file

Steve Mitchell
  • 1,895
  • 1
  • 15
  • 12
13

Looks like the logs are scattered? I found access logs under <ProjectLocation>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\logs

Santosh
  • 660
  • 7
  • 13
  • This is the most direct answer to the question: "Where can I view Tomcat log files in Eclipse?" It is not done in eclipse, but as far as I am concerned, that is a positive as I can just view them in my choice of view in a completely separate window. The other answers seem to focus on configuring eclipse to put the file somewhere handy. – Be Kind To New Users Jan 15 '16 at 03:09
  • The catalina.out file is viewed directly in Eclipse Console window. – Be Kind To New Users Jan 15 '16 at 04:01
  • @Michael_potter Not if your running a client program. – DS. Dec 12 '18 at 10:18
4

if you're after the catalina.out log and you are using eclispe with tomcat, this works for me:

  • create catelina.out some where in your computer. In my case, I put it in logs directory of my tomcat install directory e.g: /opt/apache-tomcat-7.0.83/logs/catena.out
  • go to your eclipse, in the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
  • Click on "Open launch configuration". Then click on the "Common" tab.
  • At standard input and output section, check "output file", click on file system and then selected the folder where your create your catelina.out.
  • Finally, restart the Tomcat server.
onlyme
  • 3,776
  • 2
  • 23
  • 17
2

Double click and open the server. Go to 'Arguments'. -Dcatalina.base= .. something. Go to that something. Your logs are there.

JRun
  • 3,328
  • 6
  • 27
  • 41
2

@royalsampler said:

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.

Community
  • 1
  • 1
harschware
  • 13,006
  • 17
  • 55
  • 87
1

If you want logs in a separate file other than the console: Double click on the server--> Open Launch Configuration--> Arguments --> add -Dlog.dir = "Path where you want to store this file" and restart the server.

Tip: Make sure that the server is not running when you are trying to add the argument. You should have log4j or similar logging framework in place.