Where can I view Tomcat log files in Eclipse? - java

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?

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.

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.

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

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

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.

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

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

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.

Related

Enable Tomcat localhost/Catalina Log in IntelliJ IDEA

I'm attempting to run a Java/Spring/Hibernate/ application using IntelliJ 13 and its built in Tomcat deployment plugin. When debugging a buddy of mine has the following logs.
I was wondering how to enable the logs that are in red, currently in my IDEA. I have tried the following solution.
Heading over to the Run/Debug Configurations Tomcat server and clicking on the log tab and enabling the logs
I appreciate any help or tips in advance. Thanks guys
If I am understanding your question correctly, you are not sure what to set in the "Log File Location" field of the "Edit Log File Aliases" dialog.
When you create a Tomcat Run/Debug configuration, IntelliJ IDEA creates a TOMCAT_BASE directory as {intellij_system_directory}\tomcat\{run_configuration_name}_{project_name}. (TOMCAT_HOME identifies where the binary files are and TOMCAT_BASE defines where an instance of tomcat is. Sometimes they are the same. In this case, they are not.) The {intellij_system_directory} directory is usually in ~/.IntelliJIdea13/system where ~ is your home directory (C:\Users\{username} on windows). See the document Directories used by the IDE to store settings, caches, plugins and logs. You can also go to Help > Show Log File which will pen the directory {intellij_system_directory}\logs. Just go up one directory and then into tomcat.
Just set the path to the appropriate logs directory. You can use ant file patterns to deal with dates. For example, for my Tomcat Run\Debug configuration named "My Web App" in "My Project", to view the catalina.log file, I would set the path to C:\Users\Mark\.IntelliJIdea13\system\tomcat\My_Web_App_My_Project\logs\catalina.*.log. The * wild characters the date stamp in the log name and IDEA will always open the latest/newest one.
Also take a look at this post -- https://devnet.jetbrains.com/message/5529312#5529315 -- of mine for information on a minor bug with naming of the tomcat base directories.

Checking Glassfish error log

I'm using NetBeans 7.2 and GlassFish 3.1.2 and I'm running a web application with JSPs and Servlets. There seems to be some errors in the output because I'm getting a blank webpage when the app is run. I understand that the log file is located in glassfish/domains/logs folder, but I'm not able to see any System.out or System.err inside of that text file.
Is there anything I have to configure so that I can read the log and come to know as to where I'm going wrong? Ideally I'm trying to debug the servlet.
In NetBeans, go to Tools->Servers. Select the GlassFish Server and on the 'common' tab the 'Domains folder' + the 'Domain Name' is the root folder you need to browse to on your machine. Inside of that folder, you'll see a 'logs' folder which will contain the 'server.log' file.

Tomcat server could not start

I am developing a dynamic web application on JBoss developer, but I am getting an error message:
Could not load the Tomcat server configuration at
\Servers\Tomcat v6.0 Server at localhost-config. The Servers project
is closed.
Even when I try to start the server on the servers tab, it doesn't start.
Any suggestions?
Sounds to me as if you're doing this inside Eclipse with WTP?
If so then you need to make sure that the Eclipse project called Servers which is created and maintained by WTP is open.
Open the Navigator view
Locate the Servers project
right-mouse click
Open Project
You have been closed server project in eclipse which will come by default after adding tomcat into eclipse. So try to open server project and start Tomcat it will Work..
Steps:
Go to project explorer.
Double click on server project.
You installed Tomcat v6 within eclipse using the “Add server” wizard and the “download and install” button.
You tried to start Tomcat and got the following error:
****“Could not load the Tomcat server configuration at /Servers/Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete”****
How to solve:
1) . Close Eclipse
2) . Copy all files from TOMCAT_6_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v6.0 Server at localhost-config
3) . Start Eclipse
4) . Expand the Servers project, click on the Tomcat 6 project and hit F5
5) . Start Tomcat from Eclipse
6) . Enjoy!!!
Just after many trying I got the solution for this problem. The problem is when your server is created using your IDE(Eclipse, JBoss or any) that time the server is not getting the configuration file. To resolve this problem you need to copy all the configuration files from the tomcat conf directory to your IDE server directory. If I will step out the solution than I can list the steps as-
Locate your Tomcat installation directory
Find the conf directory, sometime you will get it into skel directory
Copy all the files from conf and now change the directory to your IDE workspace
In Server directory paste all the files in your Tomcat configuration directory.
If you are using a Linux-based Eclipse:
Check user and group ownership and permissions to your server directory and subdirectories inside Eclipse. It MUST allow read-write config files by the current Eclipse user. Test it copying config files directly to it and, after that, accessing it through Eclipse text/xml editor.
It's usefull too to check the same for tomcat directory, because Eclipse may be bloked if its owner doesn't have permissions to access that files.
the solution to this problem is :
cd /usr/local/tomcat//conf
chmod 777 *
and it's done
I got the same issue. This is because it's missing "Servers" folder that contains Tomcat in Project Explorer. I already downloaded and configured my Tomcat, but after I created another new java web project, Server stopped working.
To solve this problem right click on "Tomcat v6.0 Server at localhost
[Strated,Synchronized]"
at bottom of your Eclipse.
click "General"
click "Switch Location"
click "Apply"
enter image description here
This usually happens when the "Close unrelated projects" button is clicked. A simple and straightforward solution to this issue:
Go to the bottom of the Project Explorer tab and there will be a project named "Servers". If it's closed, the icon will have a different color than the projects that are open.
Double-click on "Servers". Now the project will be open and this issue will get resolved.

Location of localhost folder in Ubuntu 12.04

I'm running eclipse Juno, with Tomcat 7.0.29. I have some files that are saved to the root of the webapp by my webapp and I want to delete them. I'm trying to find the localhost folder in order to be able to do this. Everything I'm reading tells me it should be at /var/www, however there is not /www directory in var. Where could it be?
Since you're using Eclipse IDE and you don't know where your Tomcat installation folder is, you can find it using the IDE by going to Windows/Preferences. It will pop a Preferences window, select the Server/Runtime Environment option in the left tree, in the right side must appear Apache Tomcat v7.x. Select it from the list and select the Edit... option, it will show you the tomcat installation directory. Let's call this folder <tomcat>
Now you know the folder installation, but maybe Eclipse is not using it to deploy the Java Web applications. To make sure of this, in your Eclipse, go to the Servers view (if it's not visible in the IDE, go to Window/Show view/Servers), it will show you your tomcat server (and others), double click on it. In the Tomcat overview window, check the Server locations panel, expand it and check where the webapp is deployed:
If selected option is Use Tomcat installation then the web app must be in <tomcat>webapps
If selected option is Use workspace metadata then the web app must be in your workspace inside .metadata/.plugins/org.eclipse.wst.server.core/tmp[number]/wtpwebapps (thanks to Lars Vogel blog post). This is a special folder created by Eclipse.
Default tomcat folder is at /var/lib/tomcat7. Your webapps are under /var/lib/tomcat7/webapps
Not sure what localhost folder you are referring to. There is /etc/tomcat7/Catalina/localhost but I dont see a reason why you should be touching it.
This assumes you used standard Ubuntu tools to install tomcat.

Does exist Eclipse deployment assembly log?

I have project that contains many dependencies - several hundreds jars.
For debug run on Tomcat (Debug as > Debug on Server). The problem that sometimes some jars not deployed in tomcat work directory. May be exists log of deployment or something else that can helps to understand the reason?
Thanks.
Can you view the standard Tomcat catalina log file within the Eclipse window?
This is also visible by writing it into a file.
In the Servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
Click on "Open launch configuration" in the middle of the screen. Click on the "Common" tab.
Towards the middle of the screen under "Standard Input and Output" you can check the "File" checkbox and then specify a file location that can be used to log your console output.
Restart the server and see if you have your logs.

Categories

Resources