"org.apache.felix.eventadmin.IgnoreTopic" ignored for log events

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

"org.apache.felix.eventadmin.IgnoreTopic" ignored for log events

IOOOTARobby
Context: Apache Karaf 4.1.3

Hi,
I'm trying to force the EventAdmin to do not propagate any event dealing with the logging system, but whatever value I try with the "org.apache.felix.eventadmin.IgnoreTopic" parameter gets ignored.

I've done some debugging and this is what I've noticed:
- the check is performed at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.postEvent(org.osgi.service.event.Event) line: 178, where "checkTopic(...)" is invoked
- checkTopic() applies a set of matchers (derived from the ".cfg" file) to the topic of the event considered
- the matcher is implemented by org.apache.felix.eventadmin.impl.handler.EventHandlerTracker$SubPackageMatcher.match(java.lang.String) line: 377 this way

@Override
public boolean match(final String className)
{
    final int pos = className.lastIndexOf('.');
    return pos > -1 && className.substring(0, pos + 1).startsWith(m_packageName);
}

"classname" is passed as "org/osgi/service/log/LogEntry/LOG_WARNING" (the event topic) and "m:packageName" is "org/osgi/service/log/." (derived from "org/osgi/service/log/*" in the .cfg file).

Whatever value I set in the .cfg file <b>pos will always be -1</b> and there's nothing I can do about it, since I can't choose the logging events topic string. Thus, the result will be always "false" and no event will be skipped.

What am I missing?...

Thanks in advance,


Roberto

Reply | Threaded
Open this post in threaded view
|

Re: "org.apache.felix.eventadmin.IgnoreTopic" ignored for log events

João Assunção
Hello Roberto,

A few months ago I came across the same issue. 
I think it is a bug in the EventAdmin implementation (https://issues.apache.org/jira/browse/FELIX-5738). 
Unfortunately, I didn't find an workwaround.

João Assunção

Mobile: +351 916968984
Phone: +351 211933149



On Tue, Jan 16, 2018 at 3:44 PM, [hidden email] <[hidden email]> wrote:
Context: Apache Karaf 4.1.3

Hi,
I'm trying to force the EventAdmin to do not propagate any event dealing with the logging system, but whatever value I try with the "org.apache.felix.eventadmin.IgnoreTopic" parameter gets ignored.

I've done some debugging and this is what I've noticed:
- the check is performed at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.postEvent(org.osgi.service.event.Event) line: 178, where "checkTopic(...)" is invoked
- checkTopic() applies a set of matchers (derived from the ".cfg" file) to the topic of the event considered
- the matcher is implemented by org.apache.felix.eventadmin.impl.handler.EventHandlerTracker$SubPackageMatcher.match(java.lang.String) line: 377 this way

@Override
public boolean match(final String className)
{
    final int pos = className.lastIndexOf('.');
    return pos > -1 && className.substring(0, pos + 1).startsWith(m_packageName);
}

"classname" is passed as "org/osgi/service/log/LogEntry/LOG_WARNING" (the event topic) and "m:packageName" is "org/osgi/service/log/." (derived from "org/osgi/service/log/*" in the .cfg file).

Whatever value I set in the .cfg file <b>pos will always be -1</b> and there's nothing I can do about it, since I can't choose the logging events topic string. Thus, the result will be always "false" and no event will be skipped.

What am I missing?...

Thanks in advance,


Roberto


Reply | Threaded
Open this post in threaded view
|

Re: "org.apache.felix.eventadmin.IgnoreTopic" ignored for log events

IOOOTARobby
Hi Joao,
I have taken a look at the bug you have filed, is surely related to mine, but slightly different.

In my case the usage of a wildcard is not relevant: the match() method in EventHandlerTracker$SubPackageMatcher expects a classname (something with dots), while an event topic is passed and it has slashes, not dots.
Thus the match never happens, wildcard or not.

I think that you should detect the problem in your environment even trying **without** a wildcard: can you confirm this?

If yes, I will edit the issue that you have filed: I don't think it should be classified as a minor.

Thanks,

Roberto

On 2018-01-16 17:24, João Assunção <[hidden email]> wrote:

> Hello Roberto,
>
> A few months ago I came across the same issue.
> I think it is a bug in the EventAdmin implementation (
> https://issues.apache.org/jira/browse/FELIX-5738).
> Unfortunately, I didn't find an workwaround.
>
> João Assunção
>
> Email: [hidden email]
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com
>
>
>
> On Tue, Jan 16, 2018 at 3:44 PM, [hidden email] <[hidden email]>
> wrote:
>
> > Context: Apache Karaf 4.1.3
> >
> > Hi,
> > I'm trying to force the EventAdmin to do not propagate any event dealing
> > with the logging system, but whatever value I try with the
> > "org.apache.felix.eventadmin.IgnoreTopic" parameter gets ignored.
> >
> > I've done some debugging and this is what I've noticed:
> > - the check is performed at org.apache.felix.eventadmin.
> > impl.handler.EventAdminImpl.postEvent(org.osgi.service.event.Event) line:
> > 178, where "checkTopic(...)" is invoked
> > - checkTopic() applies a set of matchers (derived from the ".cfg" file) to
> > the topic of the event considered
> > - the matcher is implemented by org.apache.felix.eventadmin.impl.handler.
> > EventHandlerTracker$SubPackageMatcher.match(java.lang.String) line: 377
> > this way
> >
> > @Override
> > public boolean match(final String className)
> > {
> >     final int pos = className.lastIndexOf('.');
> >     return pos > -1 && className.substring(0, pos +
> > 1).startsWith(m_packageName);
> > }
> >
> > "classname" is passed as "org/osgi/service/log/LogEntry/LOG_WARNING" (the
> > event topic) and "m:packageName" is "org/osgi/service/log/." (derived from
> > "org/osgi/service/log/*" in the .cfg file).
> >
> > Whatever value I set in the .cfg file <b>pos will always be -1</b> and
> > there's nothing I can do about it, since I can't choose the logging events
> > topic string. Thus, the result will be always "false" and no event will be
> > skipped.
> >
> > What am I missing?...
> >
> > Thanks in advance,
> >
> >
> > Roberto
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: "org.apache.felix.eventadmin.IgnoreTopic" ignored for log events

João Assunção
Hello Roberto,

Yes I can confirm that the issue happens with or without the wildcard.
I don't mind if you bump the issue priority, in fact I will be grateful if you do so :-)

Regards,

João Assunção

Mobile: +351 916968984
Phone: +351 211933149



On Wed, Jan 17, 2018 at 10:32 AM, iooota_robby <[hidden email]> wrote:
Hi Joao,
I have taken a look at the bug you have filed, is surely related to mine, but slightly different.

In my case the usage of a wildcard is not relevant: the match() method in EventHandlerTracker$SubPackageMatcher expects a classname (something with dots), while an event topic is passed and it has slashes, not dots.
Thus the match never happens, wildcard or not.

I think that you should detect the problem in your environment even trying **without** a wildcard: can you confirm this?

If yes, I will edit the issue that you have filed: I don't think it should be classified as a minor.

Thanks,

Roberto

On 2018-01-16 17:24, João Assunção <[hidden email]> wrote:
> Hello Roberto,
>
> A few months ago I came across the same issue.
> I think it is a bug in the EventAdmin implementation (
> https://issues.apache.org/jira/browse/FELIX-5738).
> Unfortunately, I didn't find an workwaround.
>
> João Assunção
>
> Email: [hidden email]
> Mobile: <a href="tel:%2B351%20916968984" value="+351916968984">+351 916968984
> Phone: <a href="tel:%2B351%20211933149" value="+351211933149">+351 211933149
> Web: www.exploitsys.com
>
>
>
> On Tue, Jan 16, 2018 at 3:44 PM, [hidden email] <[hidden email]>
> wrote:
>
> > Context: Apache Karaf 4.1.3
> >
> > Hi,
> > I'm trying to force the EventAdmin to do not propagate any event dealing
> > with the logging system, but whatever value I try with the
> > "org.apache.felix.eventadmin.IgnoreTopic" parameter gets ignored.
> >
> > I've done some debugging and this is what I've noticed:
> > - the check is performed at org.apache.felix.eventadmin.
> > impl.handler.EventAdminImpl.postEvent(org.osgi.service.event.Event) line:
> > 178, where "checkTopic(...)" is invoked
> > - checkTopic() applies a set of matchers (derived from the ".cfg" file) to
> > the topic of the event considered
> > - the matcher is implemented by org.apache.felix.eventadmin.impl.handler.
> > EventHandlerTracker$SubPackageMatcher.match(java.lang.String) line: 377
> > this way
> >
> > @Override
> > public boolean match(final String className)
> > {
> >     final int pos = className.lastIndexOf('.');
> >     return pos > -1 && className.substring(0, pos +
> > 1).startsWith(m_packageName);
> > }
> >
> > "classname" is passed as "org/osgi/service/log/LogEntry/LOG_WARNING" (the
> > event topic) and "m:packageName" is "org/osgi/service/log/." (derived from
> > "org/osgi/service/log/*" in the .cfg file).
> >
> > Whatever value I set in the .cfg file <b>pos will always be -1</b> and
> > there's nothing I can do about it, since I can't choose the logging events
> > topic string. Thus, the result will be always "false" and no event will be
> > skipped.
> >
> > What am I missing?...
> >
> > Thanks in advance,
> >
> >
> > Roberto
> >
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: "org.apache.felix.eventadmin.IgnoreTopic" ignored for log events

jbonofre
Hi,

as I'm committer on Felix, I  will take a look.

I assign the Jira to me and increased the priority.

Thanks !
Regards
JB

On 01/18/2018 04:57 PM, João Assunção wrote:

> Hello Roberto,
>
> Yes I can confirm that the issue happens with or without the wildcard.
> I don't mind if you bump the issue priority, in fact I will be grateful if you
> do so :-)
>
> Regards,
>
> João Assunção
>
> Email: [hidden email] <mailto:[hidden email]>
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com <http://www.exploitsys.com>
>
>
>
> On Wed, Jan 17, 2018 at 10:32 AM, iooota_robby <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Joao,
>     I have taken a look at the bug you have filed, is surely related to mine,
>     but slightly different.
>
>     In my case the usage of a wildcard is not relevant: the match() method in
>     EventHandlerTracker$SubPackageMatcher expects a classname (something with
>     dots), while an event topic is passed and it has slashes, not dots.
>     Thus the match never happens, wildcard or not.
>
>     I think that you should detect the problem in your environment even trying
>     **without** a wildcard: can you confirm this?
>
>     If yes, I will edit the issue that you have filed: I don't think it should
>     be classified as a minor.
>
>     Thanks,
>
>     Roberto
>
>     On 2018-01-16 17:24, João Assunção <[hidden email]
>     <mailto:[hidden email]>> wrote:
>      > Hello Roberto,
>      >
>      > A few months ago I came across the same issue.
>      > I think it is a bug in the EventAdmin implementation (
>      > https://issues.apache.org/jira/browse/FELIX-5738
>     <https://issues.apache.org/jira/browse/FELIX-5738>).
>      > Unfortunately, I didn't find an workwaround.
>      >
>      > João Assunção
>      >
>      > Email: [hidden email] <mailto:[hidden email]>
>      > Mobile: +351 916968984 <tel:%2B351%20916968984>
>      > Phone: +351 211933149 <tel:%2B351%20211933149>
>      > Web: www.exploitsys.com <http://www.exploitsys.com>
>      >
>      >
>      >
>      > On Tue, Jan 16, 2018 at 3:44 PM, [hidden email]
>     <mailto:[hidden email]> <[hidden email] <mailto:[hidden email]>>
>      > wrote:
>      >
>      > > Context: Apache Karaf 4.1.3
>      > >
>      > > Hi,
>      > > I'm trying to force the EventAdmin to do not propagate any event dealing
>      > > with the logging system, but whatever value I try with the
>      > > "org.apache.felix.eventadmin.IgnoreTopic" parameter gets ignored.
>      > >
>      > > I've done some debugging and this is what I've noticed:
>      > > - the check is performed at org.apache.felix.eventadmin.
>      > > impl.handler.EventAdminImpl.postEvent(org.osgi.service.event.Event) line:
>      > > 178, where "checkTopic(...)" is invoked
>      > > - checkTopic() applies a set of matchers (derived from the ".cfg" file) to
>      > > the topic of the event considered
>      > > - the matcher is implemented by org.apache.felix.eventadmin.impl.handler.
>      > > EventHandlerTracker$SubPackageMatcher.match(java.lang.String) line: 377
>      > > this way
>      > >
>      > > @Override
>      > > public boolean match(final String className)
>      > > {
>      > >     final int pos = className.lastIndexOf('.');
>      > >     return pos > -1 && className.substring(0, pos +
>      > > 1).startsWith(m_packageName);
>      > > }
>      > >
>      > > "classname" is passed as "org/osgi/service/log/LogEntry/LOG_WARNING" (the
>      > > event topic) and "m:packageName" is "org/osgi/service/log/." (derived from
>      > > "org/osgi/service/log/*" in the .cfg file).
>      > >
>      > > Whatever value I set in the .cfg file <b>pos will always be -1</b> and
>      > > there's nothing I can do about it, since I can't choose the logging events
>      > > topic string. Thus, the result will be always "false" and no event will be
>      > > skipped.
>      > >
>      > > What am I missing?...
>      > >
>      > > Thanks in advance,
>      > >
>      > >
>      > > Roberto
>      > >
>      > >
>      >
>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com