How to log mysql queries which takes more time than minimum time set by user?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to log mysql queries which takes more time than minimum time set by user?

kulwantbughipura
Hello,

Actually i want to dump all the sql queries which are executed by ofbiz when they take more time than the time specified by user.
Reply | Threaded
Open this post in threaded view
|

Re: How to log mysql queries which takes more time than minimum time set by user?

Deepak Dixit-3
Please refer GenericDAO.java file.

In Ofbiz if query took more then 150 MS then its logged on console.

{code}

if (Debug.timingOn()) {
    long queryEndTime = System.currentTimeMillis();
    long queryTotalTime = queryEndTime - queryStartTime;
    if (queryTotalTime > 150) {
        Debug.logTiming("Ran query in " + queryTotalTime + "
milli-seconds: " + " EntityName: " + modelEntity.getEntityName() + "
Sql: " + sql + " where clause:" + whereEntityConditionParams, module);
    }
}

{code}

Thanks & Regards
--
Deepak Dixit
www.hotwaxsystems.com

On Wed, Feb 10, 2016 at 1:45 PM, kulwantbughipura <
[hidden email]> wrote:

> Hello,
>
> Actually i want to dump all the sql queries which are executed by ofbiz
> when
> they take more time than the time specified by user.
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/How-to-log-mysql-queries-which-takes-more-time-than-minimum-time-set-by-user-tp4677041.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: How to log mysql queries which takes more time than minimum time set by user?

Jacques Le Roux
Administrator
Thanks Deepak,

Since we have sometimes this question I have added a FAQ entry
https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-SQLQueriesDurations

Jacques

Le 10/02/2016 11:01, Deepak Dixit a écrit :

> Please refer GenericDAO.java file.
>
> In Ofbiz if query took more then 150 MS then its logged on console.
>
> {code}
>
> if (Debug.timingOn()) {
>      long queryEndTime = System.currentTimeMillis();
>      long queryTotalTime = queryEndTime - queryStartTime;
>      if (queryTotalTime > 150) {
>          Debug.logTiming("Ran query in " + queryTotalTime + "
> milli-seconds: " + " EntityName: " + modelEntity.getEntityName() + "
> Sql: " + sql + " where clause:" + whereEntityConditionParams, module);
>      }
> }
>
> {code}
>
> Thanks & Regards
> --
> Deepak Dixit
> www.hotwaxsystems.com
>
> On Wed, Feb 10, 2016 at 1:45 PM, kulwantbughipura <
> [hidden email]> wrote:
>
>> Hello,
>>
>> Actually i want to dump all the sql queries which are executed by ofbiz
>> when
>> they take more time than the time specified by user.
>>
>>
>>
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/How-to-log-mysql-queries-which-takes-more-time-than-minimum-time-set-by-user-tp4677041.html
>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>>
Reply | Threaded
Open this post in threaded view
|

Re: How to log mysql queries which takes more time than minimum time set by user?

kulwantbughipura
In reply to this post by Deepak Dixit-3
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: How to log mysql queries which takes more time than minimum time set by user?

Jacques Le Roux
Administrator
BTW, please use rather user ML for such questions, see why here http://ofbiz.apache.org/mailing-lists.html

You will get a better support and it's more fair to share with everybody

The wider the audience the better the answers you might get

Thanks

Jacques


Le 10/02/2016 12:04, kulwantbughipura a écrit :
> Thanks.
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/How-to-log-mysql-queries-which-takes-more-time-than-minimum-time-set-by-user-tp4677041p4677049.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>