mkhalil / log4jdbc

Automatically exported from code.google.com/p/log4jdbc
0 stars 0 forks source link

Formatted SQL output #41

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 reich.ma...@gmail.com on 5 Oct 2011 at 4:49

GoogleCodeExporter commented 8 years ago
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 arthur.b...@gmail.com on 22 Mar 2012 at 1:29

GoogleCodeExporter commented 8 years ago
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 bard...@gmail.com on 6 Jan 2015 at 12:59