π ggts-logo
Have you ever had in Groovy/Grails Tool Suite (GGTS) that console output, by a running Grails application, which is exactly the same as the previous output, just isnβt displayed?
This can often be seen with println statements for debug-purposes e.g. in a Controller, which you think should output some line to the console every time, but simply doesnβt.
class TestController {
def index() {
println "index called"
}
}When http://localhost:8080/test/test/index is invoked repeatedly in the browser, you just keep seeing only the first occurence.
....index called
When the same message repeatedly is sent to the console a certain convenience feature of GGTS swallows some output β if it looks the same. It has to do with the β since Grails 2.0 introduced β ANSI codes to make some output to the console coloured or re-appear on the same line.
Kris de Volder gives a nice example in JIRA issue STS-3499 about how multiple lines such as
Resolving Dependencies. Resolving Dependencies.. Resolving Dependencies... Resolving Dependencies....
are supposed to βrewrite over themselvesβ on ANSI-supported consoles, so youβd only see
Resolving Dependencies...<increasing periods>
on the same line.
Output in the GGTS non-ANSI-enabled console is stripped from these codes β which would result in additional output which some people find unpleasant. So GGTS uses a workaround β which is enabled by default β and strips the beginning of the output which matches previous output and only print the remainder.
So if you were wondering why
class BootStrap {
def init = { servletContext ->
['A', 'B', 'B'].each { println it }
}
}would only print
|Running Grails application A B |Server running. Browse to http://localhost:8080/test
instead of
|Running Grails application A B B |Server running. Browse to http://localhost:8080/test
you know now this is not a bug :-)
You have to disable the option βClean Grails 2.0 outputβ in the GGTS preferences under Groovy > Grails > Grails Launch to prevent this swallowing-behaviour.
π ggts-disable-clean-grails-output
Now your output appears in GGTS when you want it to appear :-)
| Reference: | GGTS: Clean up Grails 2.0 output from our JCG partner Ted Vinke at the Ted Vinkeβs Blog blog. |
Thank you!
We will contact you soon.
Ted VinkeMarch 3rd, 2015Last Updated: February 27th, 2015

This site uses Akismet to reduce spam. Learn how your comment data is processed.