You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by kulwantbughipura <ku...@gmail.com> on 2016/02/10 09:15:25 UTC

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

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.

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

Posted by Jacques Le Roux <ja...@les7arts.com>.
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 <
> kulwantbughipura@gmail.com> 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.
>>

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

Posted by Jacques Le Roux <ja...@les7arts.com>.
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.
>

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

Posted by kulwantbughipura <ku...@gmail.com>.
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.

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

Posted by Deepak Dixit <de...@hotwaxsystems.com>.
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 <
kulwantbughipura@gmail.com> 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.
>