Grep Console (Eclipse Plug-in)

Developers usually have their programs write log and debug information to the standard output during coding and testing. This results in a lot of text being printed to Eclipse’s console view, often more than can be easily surveyed. Since at any given time, only a small part of this information is of primary interest to the developer, a tool which highlights specific lines or words can significantly increase the readability of this output.

Grep Console allows you to define a series of regular expressions which will be tested against the console output. Each expression matching a line will affect the style of either the entire line or parts of it. For example, error messages could be set to show up with a red background, or integer values showing the state of a certain variable could be rendered in bold font. Grep Console can also filter console output by only showing lines that match certain expressions.

Review Grep Console at the Eclipse Marketplace. Become a follower at Facebook or Google+.

Version 3.7 of Grep Console was released on 2015-04-06.

You can read the user guide here.

Donate Button with Credit CardsGrep Console is licensed under the terms of the Eclipse Public License v1.0.

82 Responses to Grep Console (Eclipse Plug-in)

  1. Channing says:

    It would be nice if there was an option to not print the line at all if it matches a pattern. Right now I am setting the foreground and background to white, but it still causes the messages I’m interested in to scroll by quickly.

    • I agree. In fact, this was the original idea, but I failed to get this working with the Eclipse components. I have an update in the works (nearly finished) that will do something similar though. To be released soon, hopefully.

      • Feiteira says:

        Please, that option would be [even more] awesome!

        • That functionality is provided by the Grep View feature, which has been part of Grep Console since version 3.0.

          • Graham Bygrave says:

            Excluding things is handy if you don’t know exactly what you’re looking for in the console, but there’s a lot of noise in the log file of an application you don’t know very well.
            So essentially, you only know what you don’t want to see, not what you do want to see.
            Cheers,
            G.

          • Graham Bygrave says:

            Actually, forget that – what I want is doable in the grep view as you say.

  2. lindbert says:

    Anyway, nice plugin, can’t live without it!

  3. michaelz8n says:

    Maybe this plugin (that I haven’t tested yet) could help (to filter lines you don’t want to read in the console) : http://code.google.com/a/eclipselabs.org/p/console-grep/

    • Thanks. That sounds pretty much like what I’m doing in the new version that’s in the new version. Except that I’m showing the results in a separate view… might be worth thinking about moving that to a custom console later on.

  4. Roger says:

    Nice plugin thanks a lot for your work. Is there a easy way to export all my expressions and to deploy it to my colleges?

    Regards, Roger

    • Two options. The upcoming version 3.0 I’ve been promising above (it’s really very close to being done now) will have options to copy & paste expressions and to export them to XML files and import them on another system.

      In the meantime, you can manually copy the settings of Grep Console between different workspaces. You’ll find the settings file in your Eclipse workspace in this sub path:

      .metadata/.plugins/org.eclipse.core.runtime/.settings/com.musgit.eclipse.grepconsole.prefs

      Just copy that to another workspace and (re)start Eclipse and you should have the same settings there. To just transfer some settings, open the file in a text editor (it’s in XML format) and copy the bits you want.

  5. Pingback: Zwei Eclipse Plugins für Juno installiert, Grep Konsole und Web | Wenzlaff.de: Rund um die Programmierung

  6. Cool, works fine.
    Thanks for nice tool :-)

    CU
    Thomas
    wenzlaff.de

  7. Pingback: Eclipse Juno – Les meilleurs plugins pour le web | Netsyos

  8. Bruno Silva says:

    Cool plugin! Really, really useful. Any way of matching an expression over several lines? For instance,

    some
    text that I want in blue

    could be regexp’d with

    .*(.*).*

    and then I would color group 1 with blue. Is this possible?

    Thanks!

    • Bruno Silva says:

      ugh, the thing ate all the tags I wrote. Anyway, it would be something like

      [blue] some text
      that I want colored
      [\blue]

      and that would be regexp’d with

      .*[blue](.*)[\blue].*

      • This would be a cool feature, and I have thought about it before. Sadly, I don’t think it’s feasible the way Grep Console is implemented at the moment. Line highlighting works through a standard SWT listener, which operates on a line by line basis. To handle ranges of multiple lines, I’d have to do handle each line manually. This would likely be a performance issue as well, as SWT only calls the line listener when a line is displayed (so when console output runs so fast that you can barely follow it, only some of the lines are actually passed to the listener), but I’m not sure if I could easily reproduce that with my own code.
        Of course, if anyone else wants to implement this, I’d be happy to accept code contributions.

  9. Lukasz says:

    Thanks for this great plugin! Here’s an idea: We could tweak it for team purpose, i.e. regexps are stored on the remote repository and shared among the team members.

    Could you post a link to the sources?

  10. Tom says:

    I cant seem to find any way to make the grep case insensitive. Have I missed something or can I ask this be added as a feature.

    • I had to look this one up in the Java API docs myself. You can use “(?i)” (sans the quotes) in your expression to deactivate case sensitivity for ASCII characters. To also make unicode characters case insensitive, you must add “(?u)”.

      Perhaps I’ll include a checkbox in the next version to make this more comfortable.

  11. nut says:

    Thanks for these cool plugin/work!! :-)
    But wondering, using Eclipse 4.2 (Juno) I’m missing the ability to open a “Grep View”. Is it right, that normally there is a entry in the pull-down Menue for “OpenConsole”?

  12. Does this work with juno?

  13. Serhii Belei says:

    I’d like to have “play sound” feature in eclipse with this plugin. Is it possible? (I can help to implement it)

  14. Jan says:

    Hi Marian, the plugin is great. Is it possible to use it for multiline comments? Am I just to dumb to create a RegExp that can get this to work?

  15. Jeremy says:

    The link http://eclipse.schedenig.name/features/name.schedenig.eclipse.grepconsole_source_3.5.1.jar is broken:
    The requested URL /features/name.schedenig.eclipse.grepconsole_source_3.5.1.jar was not found on this server.

  16. André Müller says:

    BUG?
    First: Thank you for all your time and efforts to implement such a great plugin! It is a real time-saver especially while debuggingC++ template code with its notoriously bloated error messages.
    Here is my problem which also occurs in this (I think) extremely simple setting:
    I have exactly one expression “.*(\Qerror:\E .*)” and want to use the grep view rewrite expresion “{1}” or alternatively “{match}”. Grep view will only show the first 10 characters of the capture group. Am I missing something?

    • Thanks for the info, André. I’ve tried to reproduce your setup and I suspect it may be an issue with your configuration.

      In my test, the captured strings written to Grep View were much longer than 10 characters, but the longest of them was still cut off at a certain point because of the “Grep View match length” setting in the Grep Console configuration. This setting limits the number of characters in your console lines which are used for pattern matching for performance reasons (longer strings means slower pattern matching). If relevant parts of your console lines appear after this cutoff value, your capture strings may be cut off, or your expression may not match at all. The cutoff value is an index relative to the beginning of the line, so even short capture strings far into your lines can be affected.

      If this is the cause of your problem, there are two simple solutions:

      1) Increase the match length in the configuration. This may affect performance if you have lots of console output.

      2) Use a quick expression. For items that have a quick expression, the standard expression is only used if the quick expression matches the line, and no cutoff index is used at all. The idea is that the quick expression should be simple enough to quickly filter out most irrelevant lines, so the standard expression can be tested against the full line.

      In my test, I’ve successfully gotten a match on a full line by adding the quick expression “error” (sans the quotes) to the item.

  17. Jakub Stas says:

    Hi,

    GrepConsole is really awesome and became an essential tool in my work, so I would like to ask, if it is/would be possible to open production logs in grep console view for further analysis using my custom defined patterns. I am not aware whether this is currently possible, but if not, I would really welcome this feature in the upcoming release. Please could you give your standpoint on this one? Thank you.

  18. Raul says:

    Hello, I am trying to make grepconsole start with some predefined setings , so i dont have to do them everytime i use it , but when i change the plugin.customization.ini it still doesn’t find those preferences. i am using it like this :

    name.schedenig.eclipse.grepconsole/expressions= and some other settings that continue here…is the uri ok? or should i add something else at the begining here? thanks a lot

  19. Frank Musolf says:

    Hi Marian, can grep console count occurences of regex?

    e.g. display count of exceptions in console or count of errors..

    perhaps display as icon so no wasting of place in console

  20. Ivan says:

    Hi Marian,

    first of all, thank you for this great plug-in, can’t live without it anymore!

    Do you have any idea why ‘Grep view’ doesn’t work when this plugin gets bundled in custom RCP?

    When installed into Eclipse it works excellent. However, when added to my product, console part work without errors (lines gets highlighted, etc.) but Grep view is empty all the time (‘Show in Grep view’ is checked for both – folder and expression).
    Is there some extra step in product definition that I’m missing?

    Thanks in advance,
    Ivan

    • Nestor says:

      Hi.
      I have a similar problem. Lines get highlighted, but Grep View is always empty. I checked the “Show in Grep View” on the Edit Expression dialog, and also have filled the filtering icon in the Expressions list.
      I have Grep Console 3.5.1, installed as you suggested (downloaded and then installed the zip file). I have Eclipse Kepler (Build id: 20130614-0229).
      Any help would be very appreciated.
      This is a very usefull plugin and I’d love to have this functionality working.
      Thank you in advance.
      Nestor

    • It might depend on the type of console you are using. Grep Console has to be specifically bound to different types of consoles to pick up their changes. Bindings to the JDT and CDT consoles are included, but perhaps you are using a different type of console? Where does the output you want to capture come from?

  21. Frank Musolf says:

    Hi Marian, can grepConsole collect data describe with regex to show in console header or as icon, e.g. from jboss output deployed ear-name? regards frank

    • Not so far, no. It’s an interesting idea though. So the text shown in the console header would update whenever a new line matches the regex? Where would you get the icon from – just use a regex to match a file path and load that as an image? Plus where would you put the icon? I’d have to check if it’s possible to simply change the console title, too.

  22. Guido Celada says:

    I can’t seem to colorize the maven output on my eclipse kepler (mac). Any suggestions?

  23. Frank Musolf says:

    Hi Marian,
    grep console plugin is not available in my eclipse when i replace name.schedenig.eclipse.grepconsole_3.5.1.jar with name.schedenig.eclipse.grepconsole_3.6.0.jar.
    no error in error log. grep console is completly invisible.

    what is necessary for offline update from 3.5.1 to 3.6.0?

    Regards
    Frank

  24. ave says:

    Is there a way of configuring grepconsole to use default/pre-configured settings. Is that possible? It would be *really* useful.

  25. Mohamed says:

    Thanks Marian for the awesome plugin. It saves me lots of time going through logs and cross referencing between the logs and the source code. Thanks again.

    A nice feature would be post filtering. let’s say I have a log file that consists of comma separated fields. The tool can parse the log and the UE display one dropdown menu for each field prepopulated with all the value in that field. Exactly like how it’s done in any spreadsheet program.

    Then the user can do a combination of filter the same way it’s done for spreadsheets.

    I have no idea how feasible/hard this is. But if this is doable I think it will help many.

  26. David Leonhartsberger says:

    Is it possible to do mult line regex matching with grep console?

    For example I would like to fold the following output because it takes about 60 lines:

    2014-10-06 16:58:07,880 INFO [com.mystuff.container] –

    System Environment:
    System:
    OS Name: Windows 7

    Network Interface Name: eth19 / Intel(R) Gigabit ET2 Quad Port Server Adapter
    Network Interface Name: eth20 / WAN Miniport (Network Monitor)-QoS Packet
    Home: C:\Users\dleonhar\.m2\repository\com\mystuff\

    2014-10-06 16:58:07,887 INFO more log output

  27. pierocampa says:

    ——> Awesoming !!!

  28. intf says:

    It would be nice to change option Style match length to Style match range.
    The same for Filter match length.
    Reason is performance issue.

  29. Frank Musolf says:

    Hi Marian,

    i found a nice Plugin EditBox (current Update-Site http://www.nodeclipse.org/updates/ –> choose EditBox from tree). After install you found toolbar button to activate EditBox Mode.

    When i show any server.log in eclipse editor in EditBox-Mode – very nice effect for e.g. exceptions.
    Same functionality in grepConsole?

    Regards from Hamburg
    Frank

  30. Flamefire says:

    Is it possible to have different filters with different styles even if they overlap?
    So for example you have on filter with RegEx “([tT]est)” with foreground color of group 1 = blue
    and another one that highlights every letter “e” with foreground color red.
    But currently all “e”s in “test” are also blue and there is no way to make them red even by reordering the expressions.

  31. Sebastian Paul says:

    Great plugin.
    Unfortunately, only one console is styled when there are two or more console views in parallel. Seems like a bug, as the Grep Console button appears in both toolbars.

  32. Marco says:

    First, thank you very much for your work on Grep Console. I found it very interesting. I am experiencing a funny problem, the labels of the rules (aka expressions) are not shown. Did you see this behavior before? Any tip?

    Thank you in advance.

    Eclipse Mars, sdk7, xubuntu 64

  33. Marcus says:

    I´d like to thank you for this great plugin as well. I am wondering, if there is a possibility to apply the grep console styles to more than just one console view?

    Eclipse Mars 4.51, Win7, Java8

  34. Olivier Merigon says:

    Thanks for the plugin this is exactly what I needed.
    I have issues with the “Java Type” links . I am launching a server via the “External Tool” config.
    When I click on the links that I have setup for the exceptions I get an error “No Project selected”.

    Indeed since I am launching the server via “External Tool” no project is linked to that launch configuration. Does anyone knows of a solution ?

    Thanks

  35. Doug Johnson says:

    Using Window-Show View-Other-Grep View does not add a Grep View console in the Java Perspective for me. However, if I switch the perspective to C/C++, JavaScript, or Team Synchronizing I can create the Grep View. Is there some simple setting that I have overlooked?

    Win 7, Eclipse Mars.1 Release 4.5.1 20150924-1200, Grep Console 3.7.0.

    Thanks.

  36. Jefe says:

    Hi ,
    Am new to this plugin . How do I link my program with Grep plugin. i.e if I write system.out.println(“Fail”); how do it display as red with grep plugin. Please advice.

    Thanks,
    Syed

  37. Jan Prach says:

    Thank you for the exceptional plugin Marian! I’m using it for years.

    Would it be easy to add regex line matching to file action? I have seen many logs without line number but with enough information (unique string) to write regex to find out line number in the target file. Something like adding “line_from_regex” to file action. If I have noting to fill to existing “line” field I would love to use “line_from_regex”.

    Could it be done with script? I was googling for any any “eclipse grep console script example”. No luck.

    BTW: Have you considered to putting the source to github with open development?

    Thank you! Jan

  38. Sebastian says:

    I like the statistics view. But a reset button would be nice. And an option to reset statistics when the console is cleared.

  39. Marco says:

    Hi! first, kudos, really useful plug-in. Second, my question is: does it work with Eclipse Terminal output?
    Thank you in advance

  40. Luke Hughes says:

    Thanks again for this great grep tool. Really nice to colorize output conditionally. Great for efficiency and appeal. Gave you a second donation :-)

  41. Pero says:

    Thanks, absolutely awesome plugin! It’s those small beautiful things what makes a difference

  42. mpi says:

    The matching expressions also work _without_ the leading and trailing “.*” (at least they did me in eclipse 4.5), causing _much faster_ scrolling of a large console with several highlightings.

  43. Frank Musolf says:

    Hi Marian,
    can you extend grep console for complete file viewer?

    So i can show any file with highlighting of grep console? perhaps with tail option :)

    regards
    Frank

  44. Pingback: [Spring-boot] Banner 수정하기 – OOFBIRD.NET

  45. JE says:

    Hi Marian,

    Thanks for the great plugin. I was wondering whether it would be possible to add support for distinguishing between stdout and stderr streams. Eclipse, by default, allows you to color stderr differently than stdout, but an odd “issue” arises when something written to stderr matches a grepconsole expression, in that it gets restyled per the grepconsole rule. In other words, it would be nice to be able to restrict a rule to a certain output stream (along the lines of “don’t apply this rule to stderr”).

    I’m not sure whether this is possible, or whether, by the time grepconsole “sees” the output the two streams are already merged and indistinguishable. But I imagine they can’t be completely indistinguishable, even if merged, because they’re styled differently.

    Anyway, just an idea for a feature. Thanks again for the wonderful plugin!

    • Sorry, I seem to have missed this comment earlier.

      Grep Console doesn’t directly connect to the program’s stdout and stderr streams, but instead gets the text directly from the console. The styling of stderr output in red doesn’t always become available at the same as the text, and I’m not sure how reliable it would be to distinguish the streams by display colour anyway. I’m not sure if this could would work reasonably well as a feature.

  46. tom says:

    Hallo your plug in is cool.
    Sometimes i have ein log-result and it would be nice if i could load that in the grepview to reanalyse it with the configured regex and styles.
    is this an idea or is it already possible?

    • Jörg Thönnes says:

      As a workaround the TailConsole from Marian may work. It puts the content of some file into a console view where it could be processed by GrepConsole:

      http://marian.schedenig.name/projects/tail-console/

      Finally, merging both projects somehow would be a good idea…

      • I’m sorry I missed the original comment at the time.

        As Jörg says, that’s what the Tail Console plug-in does. In fact, I don’t consider it a workaround, because Tail Console was written specifically for this purpose when I received an earlier, similar feature request.

        The two plug-ins combine well, and keeping the functionality separate means that people can install them individually depending on their needs, especially since Tail Console is much more lightweight if you don’t require the Grep functionality as well.

  47. Pingback: Lombok, AspectJ and JUnit - Beyond Java

  48. mesc says:

    works with Eclipse Photon :-)

  49. Svullo says:

    Potential bug: It seems that when I use multiple Eclipse windows, grep console only formats the console output in one of them. Closing the window where it works will make it start working in the one left. If I then open a new window again grep console will not work on the new one. All this in Eclipse Photon.

  50. Kuschmierz says:

    Hi,
    thank you for this very helpful tool. I have one question:
    If i build my project in eclipse with an external compiler, i get the following result in eclipse, even if i have errors:

    Build Finished. 0 errors, 0 warnings. (took 4s.748ms)

    Is there a way to write the correct value of errors/warnings with grep-console?

  51. Gergely Kiss says:

    Hi,

    Really cool plugin, especially with the regex group features.

    I haven’t found such functionality in other log viewers like notepad++, LogViewer eclipse plugin, etc etc, only in multitail console cmd but it is a pain to use on desktop.

    Is is possible to make grep view to open ordinary files as well not just the output of console? That would be a very useful thing.

    With Best Regards

  52. Phil says:

    Hello,

    thank you for this great tool. No matching lines are in my Grep View. I think the reason for this is that I using log4j2 in my project. If I I print the lines via “System.out.println();” it will be displayed in grep view correctly. But all logged lines via log4j2 are just in the standard eclipse console but not displayed in grep view although the configured pattern matches. Do you have any Ideas how to fix this?

    At this page Alex has the same problem: https://marian.schedenig.name/2012/08/12/grep-console-how-to-4-filtering-output-with-the-grep-view/

    My log4j2.xml looks like:

Leave a Reply

Your email address will not be published. Required fields are marked *