How to clear all console logs from different runs in eclipse? - eclipse

I have almost 10 running micro services, each printing their logs in console. for a specific reason, instead of traversing between console logs and hit clear button, I want to clear all once. Is there straightforward way?

IMHO there is no way to clear all consoles at once. You can write your own plugin to do this.
Also note that you can traverse(loop through) each console just by clicking on console icon() in the console view toolbar again and again. No need to use down arrow button of console icon then switch to each console then clear.

Related

How can I stick a process to a specific console while having more that one console open?

I am using Eclipse Mars to write test applications. Sometimes I need to run two apps at the same time so I open two consoles on my Eclipse. I can change the process being viewed on one of the consoles, but as soon as the other process prints something, it switches both consoles to show that. How can I stick a process to a specific console?
As far as I know you can't assign a process to a console. BUT you can make a process appear on a specific console none the less. To reach that you must click 'Pin Console' for the program you don't want to be changed on startup. Then in the console of the other program uncheck 'Pin Console'. The next program you start will show up in the unpinned console. So you will have to pin and unpin before each start of either one of your programs.
Maybe someone else is interested in the other steps besides the pinning and unpinning:
In the console view uncheck the buttons for
Show console view when standard out changes
and
Show console view when standard error changes
then go to the drop down menu of the console view and click
new console view
then start your first part of the application and assign one of the available consoles to that process and then start the next part and assign that to the other console. You can position both consoles as you are used to with eclipse and watch both of them simultaneously.
I tested this for eclipse luna and neon (so mars (which is in between) should have the same feature).

Eclipse - Two Console Windows display the same output

According to this thread I added a secound Console window to my Eclipse. I want to Debug two applications at the same time, so I selected the first application in one console tab and the other application in the other one.
Unfortunately whenever I start one application both Console windows switch to that one. They always switch to the application which had the last output..!
Thank you!
EDIT: After reopening the windows a few times it worked! Its kinda buggy but it works now. Thanks.
Eclipse have two options in the view's toolbar:
One is a Show console shen standard out changesand other Show console shen standard error changes.
Keep both deselected, so you can control which console do you want to view...

Running my program from PyDev with one click?

I am developing using the PyDev plugin in Eclipse. My program uses several classes in several files. I usually run the program using the green "play" icon or using Control+F11. The only problem is that it will run the file, which is currently in "focus". Usually this is not the one containing the starting point of my application. As I run my program something like 200 times a day, this means that I need 200 extra click on the mouse and often forget about this.
Is there any way of setting the default file to launch?
Yes, change the launching to rerun the last launched, so Ctrl+F11 will launch the last one -- and use F9 to launch the one with focus -- See instructions and details at: http://pydev.org/manual_101_run.html
For me, the shortcut is Ctrl+Shift+F9. I don't think I've changed any keybindings, so its strange that it would be different from the official documentation.
Go to Run->Run History, and select the run that is your 'main' run. Now you should be able to use Ctrl-Shift+F9 from any other file to rerun your main. If it isn't Ctrl+Shift+F9 for you, look on the console window that should be at the bottom of your screen showing the stdout after every run. There is an icon on the top of it that has the green start arrow with a yellow arrow underneath it pointing to the right. That is the command to relaunch with the same configuration. If you hover over that, it should tell you the keyboard shortcut you need.

Restarting an app in Eclipse

Is there any way to restart a program in Eclipse? (preferably 1-click)
I really wish the console view had something like a restart button that would kill the app and restart it with the latest changes.
This always takes me at least three clicks. I click the down arrow next to the green circle with white triangle (play button) to open the dropdown menu, then I click to choose the Java main that I want to run, and then to stop I click the red square terminate button in the console view. Is there any easier way to do this that requires fewer clicks?
In Eclipse 4.1
open:
windows->Preferences->keys
in the filter text type: terminate and relaunch
In the binding add your binding (i use shift-F5)
For "when" select "In Windows"
This will do it in single shorcut for you.
Or install relaunch plugin:
https://bitbucket.org/mantis78/relaunch-plugin/wiki/Home
which will enable you to restart anywhere
If you use "build automatically", there is a good chance that your changes are applied on the running program, on the fly. As such, most changes will be effective directly without a need to restart.
If there is a structural difference and Eclipse can't inject the new code (for example if you change anonymous classes, or inheritance patterns), then you will be prompted with a dialog inviting you to restart the application in one click:
Exceptions are when you change the value of a static variable (or of the initialization of a class that won't be executed again until you restart the application). In this case indeed, you will need to restart explicitly with another method.
the console view has a terminate button (a red square) which stops the execution. then another click on the Run button (the green circle with triangle) begins execution again.
thats what i do - 2 clicks :)
If you're using Eclipse with Spring you could download the "Spring Tools X" plugin.
This will automatically add a start and relaunch button to the top bar menu.
It should be available on any perspective.
I haven't found an elegant solution for this problem, but if your program is short running and you can live with a few instances here and there, you can just use the run command. Its default shortcut is Ctrl+F11. Every time you press this, your application will restart. BUT! If you press this while your application is still running, another instance will be run because the "old" instance won't be automatically terminated.
There are ways to really terminate your application using shortcut keys, but that requires setting breakpoints and then using the "terminate" command, and that isn't very elegant.
When developing my own network application, I have added a code to check if the older instance is running, and if so, then send an agreed command over network socket for graceful shutdown. While this approach may not be the best as universal solution, it allows clean shutdown of the previous instance, rather than just killing it.
Easy way without plugin, every Eclipse !
Click the project from of this icon at this time hold the shift Button, Project will restart (Terminate and relaunch) with server port also.

Where do Eclipse sub-processes (launched with the "run" menu) show up?

I'm using Eclipse 3.4.1, moving my first steps. When I run my project (a server process) a console opens. But for some reasons after a while I can't find it anymore (even if the process is still up). I'd like to find it to be able to see its output and/or kill it.
Is there a place in Eclipse where I can find all running sub-processes?
There is a small button that looks like a monitor in the console panel. It lists all open consoles.
I'm ashamed I didn't find it myself before posting the question, but maybe it will be useful to someone.
If you are talking about "eclipse console", there is only one "console view", but several console instances.
You can browse the different consoles by clicking on the second button from the left in the console view (the one looking like a monitor)
Your console may 'disappear' because another message is displayed in the main console (stdout) process, while your server still runs with the other console instance.
An easier way if you are dealing with lots of processes is to use the Debug view (note: NOT the debug perspective, just the debug 'view' or 'window').
It shows a list of running processes, including processes started with Run instead of Debug. Selecting a process in the Debug view will open the corresponding Console, and visa-versa.
I put the Debug view above the Console view and size it to show just a few lines.