Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see my server logs in IntelliJ IDEA Community Edition

I just got a new PC at work and I'm giving IntelliJ IDEA Community Edition a go because I'm not the biggest fan of Eclipse. I figure now is the perfect time to try another IDE.

I can't seem to figure out how to see my app server logs/exceptions in the IDE, though. The closest thing I've found is to enable two checkboxes (they were unchecked on a fresh install) via:

Run --> Edit Configurations --> Application --> Logs (tab)

X Show console when standard out changes

X Show console when standard error changes

I'm just not finding any window/pane/tab with logs I can turn on. I've stopped/restarted my server, quit/relaunched IntelliJ.

Are server logs not available o view in the Community Edition IDE?

like image 463
magenta placenta Avatar asked Jun 11 '15 18:06

magenta placenta


People also ask

Where are IntelliJ Tomcat logs?

For Tomcat the actual logs are placed under CATALINA_BASE/logs directory. The value of the CATALINA_BASE set by IntelliJ IDEA will be printed in the console of the Run or Debug tool window. You can also find the log files under idea. system.

How do I open the event log in IntelliJ?

All notifications and events that occur in IntelliJ IDEA are gathered in the Notifications tool window. You can open the tool window by clicking the corresponding tool window bar on the right side of the editor. Alternatively, from the main menu, select View | Tool Windows | Notifications.


2 Answers

Most likely your server is writing to its own log files, and not to System.out or System.err. Where those are located will depend on your server. For example, Tomcat's logs will be in <tomcatInstallDir>/logs. The Ultimate edition, which has server run configurations, will automatically open those logs (for most server types). For the Communality Edition, you will need to find where those logs are and then configure IDEA to automatically show them when you run your application.

On the "logs" tab, add a "Log file to be shown in console" by clicking the add button enter image description hereon the right. Then define the log file location. You can use an Ant File Pattern to match the file. This is useful for log files with a date in them. If you leave the "Show All files coverable by pattern" unchecked, IntelliJ IDEA will only show the latest/newest one. Finally, after creating the log definition, you can check the "Skip Content" button if you only want new messages shown when you launch the application/server (that is only messages from the current run. Messages from previous runs are not shown.)

Here's an example:

enter image description here

The above example was done in the Ultimate Edition. But the Community Edition has the same logs tab.

UPDATE

In response to your (first) comment, the log will appear as a tab on the run (or debug) tool window when you run your application. The tab name will match the alias you entered in the above configuration. For example:

enter image description here

Note: The text highlighting and output folding is done via the Grep Console Plug-in

I will mention a few "gotchas" with this feature:

  1. It takes a few seconds for the log tabs to display. As a result, for a very quick running app (like a simple test), the tab may not end up showing
  2. When using the "Skip Content" feature, sometimes the log tab is empty the first time you run the application. This seems especially problematic for log files that are not using a file pattern. Unfortunately I have not been able to nail down a consistent use case in order to open up a bug report. Turning off "skip Content" resolves the issue.

I hope that helps.

like image 52
Javaru Avatar answered Sep 24 '22 06:09

Javaru


I don't know about "Community Edition", but mine is IntelliJ Idea 15.0.3 & I found this one working for me. aplogies if yours is different version.

Go to View > Tool Windows > Application Servers

Now you can see server widget on the lower left side of IntelliJIdea Now, whenever you will debug / run the project, your server's log will be displayed here in the tab right of servers. (As, Tomcat Localhost Log & Tomcat Catalina Log in my case) shown in the attached screenshot below. Please refer.

enter image description here

like image 37
NIKHIL CHAURASIA Avatar answered Sep 22 '22 06:09

NIKHIL CHAURASIA