You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "roberto@iooota.com" <ro...@iooota.com> on 2018/01/16 15:44:31 UTC

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

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


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

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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: joao.assuncao@exploitsys.com <ma...@exploitsys.com>
> 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 <roberto@iooota.com 
> <ma...@iooota.com>> 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 <joao.assuncao@exploitsys.com
>     <ma...@exploitsys.com>> 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: joao.assuncao@exploitsys.com <ma...@exploitsys.com>
>      > 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, roberto@iooota.com
>     <ma...@iooota.com> <roberto@iooota.com <ma...@iooota.com>>
>      > 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é
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

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

Posted by João Assunção <jo...@exploitsys.com>.
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: joao.assuncao@exploitsys.com
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com



On Wed, Jan 17, 2018 at 10:32 AM, iooota_robby <ro...@iooota.com> 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 <jo...@exploitsys.com> 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: joao.assuncao@exploitsys.com
> > Mobile: +351 916968984
> > Phone: +351 211933149
> > Web: www.exploitsys.com
> >
> >
> >
> > On Tue, Jan 16, 2018 at 3:44 PM, roberto@iooota.com <ro...@iooota.com>
> > 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
> > >
> > >
> >
>

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

Posted by iooota_robby <ro...@iooota.com>.
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 <jo...@exploitsys.com> 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: joao.assuncao@exploitsys.com
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com
> 
> 
> 
> On Tue, Jan 16, 2018 at 3:44 PM, roberto@iooota.com <ro...@iooota.com>
> 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
> >
> >
> 

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

Posted by João Assunção <jo...@exploitsys.com>.
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: joao.assuncao@exploitsys.com
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com



On Tue, Jan 16, 2018 at 3:44 PM, roberto@iooota.com <ro...@iooota.com>
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
>
>