SQL Logging?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

SQL Logging?

Stephan.Schmidt
Is there a way to log all SQL statements going from GORM to the db or do
I need

http://www.p6spy.com/

?

And if I need P6, could it be integrated into Grails for debugging?

Thanks
bye
-stephan
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

graemer
add:

log4j.logger.org.hibernate=debug, stdout

To the log4j.properties file in:

tmp/war/WEB-INF

cheers
Graeme

On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:

> Is there a way to log all SQL statements going from GORM to the db or do
> I need
>
> http://www.p6spy.com/
>
> ?
>
> And if I need P6, could it be integrated into Grails for debugging?
>
> Thanks
> bye
> -stephan
>
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Stephan.Schmidt
This is way too verbose, Only SQL statements would be useful

bye
-stephan

> add:
>
> log4j.logger.org.hibernate=debug, stdout
>
> To the log4j.properties file in:
>
> tmp/war/WEB-INF
>
> cheers
> Graeme
>
> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>> Is there a way to log all SQL statements going from GORM to the db  
>> or do
>> I need
>>
>> http://www.p6spy.com/
>>
>> ?
>>
>> And if I need P6, could it be integrated into Grails for debugging?
>>
>> Thanks
>> bye
>> -stephan
>>

Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

graemer
On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> This is way too verbose, Only SQL statements would be useful
Hmm not sure, would need to find out the exact class in hibernate that
does this and add log4j settings for it.

Graeme

>
> bye
> -stephan
>
> > add:
> >
> > log4j.logger.org.hibernate=debug, stdout
> >
> > To the log4j.properties file in:
> >
> > tmp/war/WEB-INF
> >
> > cheers
> > Graeme
> >
> > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> >> Is there a way to log all SQL statements going from GORM to the db
> >> or do
> >> I need
> >>
> >> http://www.p6spy.com/
> >>
> >> ?
> >>
> >> And if I need P6, could it be integrated into Grails for debugging?
> >>
> >> Thanks
> >> bye
> >> -stephan
> >>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Steven Devijver
There's a hibernate option to enable the SQL logging:

hibernate.show_sql=true

Steven

On 3/27/06, Graeme Rocher <[hidden email]> wrote:

> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> > This is way too verbose, Only SQL statements would be useful
> Hmm not sure, would need to find out the exact class in hibernate that
> does this and add log4j settings for it.
>
> Graeme
>
> >
> > bye
> > -stephan
> >
> > > add:
> > >
> > > log4j.logger.org.hibernate=debug, stdout
> > >
> > > To the log4j.properties file in:
> > >
> > > tmp/war/WEB-INF
> > >
> > > cheers
> > > Graeme
> > >
> > > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> > >> Is there a way to log all SQL statements going from GORM to the db
> > >> or do
> > >> I need
> > >>
> > >> http://www.p6spy.com/
> > >>
> > >> ?
> > >>
> > >> And if I need P6, could it be integrated into Grails for debugging?
> > >>
> > >> Thanks
> > >> bye
> > >> -stephan
> > >>
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

graemer
On 3/27/06, Steven Devijver <[hidden email]> wrote:
> There's a hibernate option to enable the SQL logging:
>
> hibernate.show_sql=true
Thats true.. I believe you need to add hibernate.properties to your classpath

We should maybe make this easier.. maybe a setting on the data source

Cheers
Graeme

>
> Steven
>
> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
> > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> > > This is way too verbose, Only SQL statements would be useful
> > Hmm not sure, would need to find out the exact class in hibernate that
> > does this and add log4j settings for it.
> >
> > Graeme
> >
> > >
> > > bye
> > > -stephan
> > >
> > > > add:
> > > >
> > > > log4j.logger.org.hibernate=debug, stdout
> > > >
> > > > To the log4j.properties file in:
> > > >
> > > > tmp/war/WEB-INF
> > > >
> > > > cheers
> > > > Graeme
> > > >
> > > > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> > > >> Is there a way to log all SQL statements going from GORM to the db
> > > >> or do
> > > >> I need
> > > >>
> > > >> http://www.p6spy.com/
> > > >>
> > > >> ?
> > > >>
> > > >> And if I need P6, could it be integrated into Grails for debugging?
> > > >>
> > > >> Thanks
> > > >> bye
> > > >> -stephan
> > > >>
> > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Stephan.Schmidt
>
> We should maybe make this easier.. maybe a setting on the data source

Yes, good idea.

bye
-stephan

>
> Cheers
> Graeme
>
>>
>> Steven
>>
>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>>>> This is way too verbose, Only SQL statements would be useful
>>> Hmm not sure, would need to find out the exact class in hibernate  
>>> that
>>> does this and add log4j settings for it.
>>>
>>> Graeme
>>>
>>>>
>>>> bye
>>>> -stephan
>>>>
>>>>> add:
>>>>>
>>>>> log4j.logger.org.hibernate=debug, stdout
>>>>>
>>>>> To the log4j.properties file in:
>>>>>
>>>>> tmp/war/WEB-INF
>>>>>
>>>>> cheers
>>>>> Graeme
>>>>>
>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>>>>>> Is there a way to log all SQL statements going from GORM to  
>>>>>> the db
>>>>>> or do
>>>>>> I need
>>>>>>
>>>>>> http://www.p6spy.com/
>>>>>>
>>>>>> ?
>>>>>>
>>>>>> And if I need P6, could it be integrated into Grails for  
>>>>>> debugging?
>>>>>>
>>>>>> Thanks
>>>>>> bye
>>>>>> -stephan
>>>>>>
>>>>
>>>>
>>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Steven Devijver
In reply to this post by graemer
You can also configure the hibernateProperties property on
LocalSessionFactoryBean.

Steven

On 3/27/06, Graeme Rocher <[hidden email]> wrote:

> On 3/27/06, Steven Devijver <[hidden email]> wrote:
> > There's a hibernate option to enable the SQL logging:
> >
> > hibernate.show_sql=true
> Thats true.. I believe you need to add hibernate.properties to your classpath
>
> We should maybe make this easier.. maybe a setting on the data source
>
> Cheers
> Graeme
>
> >
> > Steven
> >
> > On 3/27/06, Graeme Rocher <[hidden email]> wrote:
> > > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> > > > This is way too verbose, Only SQL statements would be useful
> > > Hmm not sure, would need to find out the exact class in hibernate that
> > > does this and add log4j settings for it.
> > >
> > > Graeme
> > >
> > > >
> > > > bye
> > > > -stephan
> > > >
> > > > > add:
> > > > >
> > > > > log4j.logger.org.hibernate=debug, stdout
> > > > >
> > > > > To the log4j.properties file in:
> > > > >
> > > > > tmp/war/WEB-INF
> > > > >
> > > > > cheers
> > > > > Graeme
> > > > >
> > > > > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> > > > >> Is there a way to log all SQL statements going from GORM to the db
> > > > >> or do
> > > > >> I need
> > > > >>
> > > > >> http://www.p6spy.com/
> > > > >>
> > > > >> ?
> > > > >>
> > > > >> And if I need P6, could it be integrated into Grails for debugging?
> > > > >>
> > > > >> Thanks
> > > > >> bye
> > > > >> -stephan
> > > > >>
> > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Stephan.Schmidt
And how is this done in grails? :-))

(But nonetheless, easier - hibernate agnostic - would be better,
  like add some properties do datasource)

bye
-stephan

> You can also configure the hibernateProperties property on
> LocalSessionFactoryBean.
>
> Steven
>
> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
>> On 3/27/06, Steven Devijver <[hidden email]> wrote:
>>> There's a hibernate option to enable the SQL logging:
>>>
>>> hibernate.show_sql=true
>> Thats true.. I believe you need to add hibernate.properties to  
>> your classpath
>>
>> We should maybe make this easier.. maybe a setting on the data source
>>
>> Cheers
>> Graeme
>>
>>>
>>> Steven
>>>
>>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>>>>> This is way too verbose, Only SQL statements would be useful
>>>> Hmm not sure, would need to find out the exact class in  
>>>> hibernate that
>>>> does this and add log4j settings for it.
>>>>
>>>> Graeme
>>>>
>>>>>
>>>>> bye
>>>>> -stephan
>>>>>
>>>>>> add:
>>>>>>
>>>>>> log4j.logger.org.hibernate=debug, stdout
>>>>>>
>>>>>> To the log4j.properties file in:
>>>>>>
>>>>>> tmp/war/WEB-INF
>>>>>>
>>>>>> cheers
>>>>>> Graeme
>>>>>>
>>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>>>>>>> Is there a way to log all SQL statements going from GORM to  
>>>>>>> the db
>>>>>>> or do
>>>>>>> I need
>>>>>>>
>>>>>>> http://www.p6spy.com/
>>>>>>>
>>>>>>> ?
>>>>>>>
>>>>>>> And if I need P6, could it be integrated into Grails for  
>>>>>>> debugging?
>>>>>>>
>>>>>>> Thanks
>>>>>>> bye
>>>>>>> -stephan
>>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Steven Devijver
Stephan,

We need to add a property to the DataSource. Can you please create a JIRA issue?

Thanks

Steven

On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:

> And how is this done in grails? :-))
>
> (But nonetheless, easier - hibernate agnostic - would be better,
>   like add some properties do datasource)
>
> bye
> -stephan
>
> > You can also configure the hibernateProperties property on
> > LocalSessionFactoryBean.
> >
> > Steven
> >
> > On 3/27/06, Graeme Rocher <[hidden email]> wrote:
> >> On 3/27/06, Steven Devijver <[hidden email]> wrote:
> >>> There's a hibernate option to enable the SQL logging:
> >>>
> >>> hibernate.show_sql=true
> >> Thats true.. I believe you need to add hibernate.properties to
> >> your classpath
> >>
> >> We should maybe make this easier.. maybe a setting on the data source
> >>
> >> Cheers
> >> Graeme
> >>
> >>>
> >>> Steven
> >>>
> >>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
> >>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> >>>>> This is way too verbose, Only SQL statements would be useful
> >>>> Hmm not sure, would need to find out the exact class in
> >>>> hibernate that
> >>>> does this and add log4j settings for it.
> >>>>
> >>>> Graeme
> >>>>
> >>>>>
> >>>>> bye
> >>>>> -stephan
> >>>>>
> >>>>>> add:
> >>>>>>
> >>>>>> log4j.logger.org.hibernate=debug, stdout
> >>>>>>
> >>>>>> To the log4j.properties file in:
> >>>>>>
> >>>>>> tmp/war/WEB-INF
> >>>>>>
> >>>>>> cheers
> >>>>>> Graeme
> >>>>>>
> >>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> >>>>>>> Is there a way to log all SQL statements going from GORM to
> >>>>>>> the db
> >>>>>>> or do
> >>>>>>> I need
> >>>>>>>
> >>>>>>> http://www.p6spy.com/
> >>>>>>>
> >>>>>>> ?
> >>>>>>>
> >>>>>>> And if I need P6, could it be integrated into Grails for
> >>>>>>> debugging?
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>> bye
> >>>>>>> -stephan
> >>>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Stephan.Schmidt
> We need to add a property to the DataSource. Can you please create  
> a JIRA issue?

Done.

But could you explain to me how I get SQL logging in Grails now? :-)

A hack would do.

thanks
-stephan

> Stephan,
>
> We need to add a property to the DataSource. Can you please create  
> a JIRA issue?
>
> Thanks
>
> Steven
>
> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>> And how is this done in grails? :-))
>>
>> (But nonetheless, easier - hibernate agnostic - would be better,
>>   like add some properties do datasource)
>>
>> bye
>> -stephan
>>
>>> You can also configure the hibernateProperties property on
>>> LocalSessionFactoryBean.
>>>
>>> Steven
>>>
>>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
>>>> On 3/27/06, Steven Devijver <[hidden email]> wrote:
>>>>> There's a hibernate option to enable the SQL logging:
>>>>>
>>>>> hibernate.show_sql=true
>>>> Thats true.. I believe you need to add hibernate.properties to
>>>> your classpath
>>>>
>>>> We should maybe make this easier.. maybe a setting on the data  
>>>> source
>>>>
>>>> Cheers
>>>> Graeme
>>>>
>>>>>
>>>>> Steven
>>>>>
>>>>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
>>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>>>>>>> This is way too verbose, Only SQL statements would be useful
>>>>>> Hmm not sure, would need to find out the exact class in
>>>>>> hibernate that
>>>>>> does this and add log4j settings for it.
>>>>>>
>>>>>> Graeme
>>>>>>
>>>>>>>
>>>>>>> bye
>>>>>>> -stephan
>>>>>>>
>>>>>>>> add:
>>>>>>>>
>>>>>>>> log4j.logger.org.hibernate=debug, stdout
>>>>>>>>
>>>>>>>> To the log4j.properties file in:
>>>>>>>>
>>>>>>>> tmp/war/WEB-INF
>>>>>>>>
>>>>>>>> cheers
>>>>>>>> Graeme
>>>>>>>>
>>>>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
>>>>>>>>> Is there a way to log all SQL statements going from GORM to
>>>>>>>>> the db
>>>>>>>>> or do
>>>>>>>>> I need
>>>>>>>>>
>>>>>>>>> http://www.p6spy.com/
>>>>>>>>>
>>>>>>>>> ?
>>>>>>>>>
>>>>>>>>> And if I need P6, could it be integrated into Grails for
>>>>>>>>> debugging?
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> bye
>>>>>>>>> -stephan
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: SQL Logging?

Steven Devijver
Hmmm,

You would have to hack the Spring configuration creation of Grails.
Look at SpringConfig:369.

Steven

On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:

> > We need to add a property to the DataSource. Can you please create
> > a JIRA issue?
>
> Done.
>
> But could you explain to me how I get SQL logging in Grails now? :-)
>
> A hack would do.
>
> thanks
> -stephan
>
> > Stephan,
> >
> > We need to add a property to the DataSource. Can you please create
> > a JIRA issue?
> >
> > Thanks
> >
> > Steven
> >
> > On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> >> And how is this done in grails? :-))
> >>
> >> (But nonetheless, easier - hibernate agnostic - would be better,
> >>   like add some properties do datasource)
> >>
> >> bye
> >> -stephan
> >>
> >>> You can also configure the hibernateProperties property on
> >>> LocalSessionFactoryBean.
> >>>
> >>> Steven
> >>>
> >>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
> >>>> On 3/27/06, Steven Devijver <[hidden email]> wrote:
> >>>>> There's a hibernate option to enable the SQL logging:
> >>>>>
> >>>>> hibernate.show_sql=true
> >>>> Thats true.. I believe you need to add hibernate.properties to
> >>>> your classpath
> >>>>
> >>>> We should maybe make this easier.. maybe a setting on the data
> >>>> source
> >>>>
> >>>> Cheers
> >>>> Graeme
> >>>>
> >>>>>
> >>>>> Steven
> >>>>>
> >>>>> On 3/27/06, Graeme Rocher <[hidden email]> wrote:
> >>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> >>>>>>> This is way too verbose, Only SQL statements would be useful
> >>>>>> Hmm not sure, would need to find out the exact class in
> >>>>>> hibernate that
> >>>>>> does this and add log4j settings for it.
> >>>>>>
> >>>>>> Graeme
> >>>>>>
> >>>>>>>
> >>>>>>> bye
> >>>>>>> -stephan
> >>>>>>>
> >>>>>>>> add:
> >>>>>>>>
> >>>>>>>> log4j.logger.org.hibernate=debug, stdout
> >>>>>>>>
> >>>>>>>> To the log4j.properties file in:
> >>>>>>>>
> >>>>>>>> tmp/war/WEB-INF
> >>>>>>>>
> >>>>>>>> cheers
> >>>>>>>> Graeme
> >>>>>>>>
> >>>>>>>> On 3/27/06, Stephan J. Schmidt <[hidden email]> wrote:
> >>>>>>>>> Is there a way to log all SQL statements going from GORM to
> >>>>>>>>> the db
> >>>>>>>>> or do
> >>>>>>>>> I need
> >>>>>>>>>
> >>>>>>>>> http://www.p6spy.com/
> >>>>>>>>>
> >>>>>>>>> ?
> >>>>>>>>>
> >>>>>>>>> And if I need P6, could it be integrated into Grails for
> >>>>>>>>> debugging?
> >>>>>>>>>
> >>>>>>>>> Thanks
> >>>>>>>>> bye
> >>>>>>>>> -stephan
> >>>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>
> >>
>
>


--
Steven Devijver
Senior Consultant
Interface21
Spring Services from the Source
http://www.interface21.com

Co-author, "Expert Spring MVC and Web Flow"
(February 2006, with Seth Ladd, Darren Davison, and Colin Yates)
http://www.amazon.com/gp/product/159059584X

Interface21 NL B.V.
Donker Curtiusstraat 7-400c
1051JL Amsterdam
The Netherlands
Phone: +31 (0)20 486 47 63
Fax: +31 (0)20 475 08 28
Mail: [hidden email]
Skype: devijvers