When working with Grails (especially, when slapping it over legacy database, man) it’s often helpful to see the hip SQL the framework generates when manipulating domain objects. As mapping a legacy database to Grails can be tricky (but indeed, solvable, baby!), seeing generated SQL can unveil incorrect mapping, etc. Luckily, you can easily enable SQL logging without having to mess with Log4J configurations (i.e. debug, error, warn “packages blah blah”). In the DataSource.groovy file in your project’s grails-app/conf directory, simply add the loggingSql variable to a desired dataSource closure (that is, you can enable this feature for a particular environment or all of them) like so:<pre class="prettyprint"><code>dataSource { //blah blah loggingSql = true }After that, you’ll notice that all SQL statements Grails (or really, Hibernate) utilizes will be logged to whichever appender you’ve configured (i.e. System.out, by default). This little tip has proved quite copacetic for me, man! Can you dig it? You can now follow The Disco Blog on Twitter, baby! JavaOpen SourceSoftware Development