log4jdbc icon indicating copy to clipboard operation
log4jdbc copied to clipboard

Formatted SQL output

Open GoogleCodeExporter opened this issue 9 years ago • 2 comments

It would be nice to have the SQL Output formatted for better readability.
In Hibernate is e.g. a special parameter : formatted_sql

The output in Logger:
Hibernate: 
    select
        emailsv0_.bean_id as bean1_147_,
        emailsv0_.bean_module as bean2_147_,
        emailsv0_.email_address as email3_147_,
        emailsv0_.email_address_caps as email4_147_,
        emailsv0_.id as id147_ 
    from
        sugarcrm.emails_v emailsv0_ 
    where
        emailsv0_.email_address_caps='SDASDSADFDSFSDSD' 
        and emailsv0_.bean_module='Contacts'

versus

JDBC Logger: 
 com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
3. select emailsv0_.bean_id as bean1_147_, emailsv0_.bean_module as bean2_147_, 
emailsv0_.email_address 
as email3_147_, emailsv0_.email_address_caps as email4_147_, emailsv0_.id as 
id147_ from sugarcrm.emails_v 
emailsv0_ where emailsv0_.email_address_caps='SDASDSADFDSFSDSD' and 
emailsv0_.bean_module='Contacts' 

Original issue reported on code.google.com by [email protected] on 5 Oct 2011 at 4:49

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

Yeah, that is really nice.  I really am trying to avoid parsing the SQL though 
as that would add a lot of complexity and could impact performance.  On the 
other hand, it could open up a lot of power and pave the way for a lot of cool 
new features.  But right now I have no time to embark on something like now.  
But it is still something to keep on the wish list for future possibilities.

Original comment by [email protected] on 22 Mar 2012 at 1:29

  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

https://github.com/hibernate/hibernate-orm/blob/b943525c80b411c9fa1f66b44f8a5b14
f928bf34/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFo
rmatterImpl.java

Original comment by [email protected] on 6 Jan 2015 at 12:59

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter