Where can I view Tomcat log files in Eclipse?

JavaEclipseTomcatLogging

Java Problem Overview


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?

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

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.

Solution 3 - Java

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

Solution 4 - Java

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

Solution 5 - Java

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.

Solution 6 - Java

@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.

Solution 7 - Java

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

Solution 8 - Java

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBlankmanView Question on Stackoverflow
Solution 1 - JavacodestaView Answer on Stackoverflow
Solution 2 - JavaroyalsamplerView Answer on Stackoverflow
Solution 3 - JavaSteve MitchellView Answer on Stackoverflow
Solution 4 - JavaSantoshView Answer on Stackoverflow
Solution 5 - JavaonlymeView Answer on Stackoverflow
Solution 6 - JavaharschwareView Answer on Stackoverflow
Solution 7 - JavaJRunView Answer on Stackoverflow
Solution 8 - JavaVineela ThonupunuriView Answer on Stackoverflow