You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by opsharma1986 <op...@gmail.com> on 2017/11/15 13:20:37 UTC
Logging query on server node sent from client node
Is there a way to log query sent by client node on the server node.
I tried this way
IgnitePredicate<EventAdapter> locLsnr = new IgnitePredicate<EventAdapter>()
{
@Override
public boolean apply(EventAdapter evt) {
switch (evt.type()) {
case EventType.EVT_CACHE_QUERY_EXECUTED:
CacheQueryExecutedEvent cacheExecEvent = (CacheQueryExecutedEvent)evt;
String clause = cacheExecEvent.clause();
System.out.println("query "+clause);
break;
case EventType.EVT_CACHE_QUERY_OBJECT_READ:
CacheQueryExecutedEvent cacheObjReadEvent =
(CacheQueryExecutedEvent)evt;
String clause2 = cacheObjReadEvent.clause();
System.out.println("query "+clause2);
break;
default:
System.out.println(evt.getClass());
break;
}
return true;
}
};
ignite.events().localListen(locLsnr,
EventType.EVT_CACHE_QUERY_EXECUTED, EventType.EVT_CACHE_QUERY_OBJECT_READ);
But, this did not work
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Logging query on server node sent from client node
Posted by Michael Cherkasov <mi...@gmail.com>.
Hi,
I don't think that you run ignite with proper configuration, because the
snippet that you sent won't work.
EventType.EVTS_CACHE_QUERY is array and you should have the folllowin
exception on logs:
Caused by: org.springframework.beans.TypeMismatchException: Failed to
convert property value of type 'java.util.ArrayList' to required type
'int[]' for property 'includeEventTypes'; nested exception is
java.lang.IllegalArgumentException: Cannot convert value of type 'int[]' to
required type 'int' for property 'includeEventTypes[9]': PropertyEditor
[org.springframework.beans.propertyeditors.CustomNumberEditor] returned
inappropriate value of type 'int[]'
replace it with:
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_QUERY_OBJECT_READ"/>
I attached working example to the email.
Thanks,
Mike.
2017-11-16 10:50 GMT+03:00 opsharma1986 <op...@gmail.com>:
> Yes, tried this below configuration
> <bean abstract="true" id="ignite.cfg"
> class="org.apache.ignite.configuration.
> IgniteConfiguration">
> <property name="includeEventTypes">
> <util:constant
> static-field="org.apache.ignite.events.EventType.EVTS_CACHE_QUERY"/>
> </property>
> ...
> Rest-of-the-configs
>
> It did not work for me.
>
> Thanks
> Om
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: Logging query on server node sent from client node
Posted by opsharma1986 <op...@gmail.com>.
Yes, tried this below configuration
<bean abstract="true" id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="includeEventTypes">
<util:constant
static-field="org.apache.ignite.events.EventType.EVTS_CACHE_QUERY"/>
</property>
...
Rest-of-the-configs
It did not work for me.
Thanks
Om
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Logging query on server node sent from client node
Posted by Mikhail <mi...@gmail.com>.
Hi,
did you enabled events in configurations:
https://apacheignite.readme.io/docs/events#section-configuration
?
Thanks,
Mike.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/