Somashekhar, Hope you don't mind if I copy the public list on this? Just in case anyone else can chime in and help.
To be completely honest ;) I last used slf4j Marker in a previous life, many years ago, and that was not in Karaf and with logback instead log4j (v2). But I just did some research online to see if perhaps it's simply not supported in Karaf.. On https://groups.google.com/d/msg/ops4j/hESm3EsmmUU/aKeUprDQgFUJ from 2013 Guillaume tells Christian that it's not. But in https://ops4j1.jira.com/browse/PAXLOGGING-43 also from 2008 already there seems to be a fix, and in https://ops4j1.jira.com/browse/PAXLOGGING-160 and https://ops4j1.jira.com/browse/PAXLOGGING-161 work seems to have been done to support it... hm. (FYI this Pax Logging thing is what Karaf uses to offer you a slf4j API implementation, based on log4j; if this sounds confusing, it's because it is! ;=) So sounds like it should work. When you write "I am able to redirect logs to the mentioned file(this I have tested by making onMisMatch=ACCEPT), but my marked log is never filtered." what does that mean - you see the "Connect, Node: " message in that openflow.log, but you also see everything else, so the mismatch deny is not yet working? Or the other way around? I suspect there may just be a small mistake somewhere in your configuration shown below. Looking at https://logging.apache.org/log4j/2.0/manual/filters.html, I don't suppose it's as simple as that your "onMisMatch" should really be "onMismatch" - but you could give it a try to see if that helps? (FTR: This https://logging.apache.org/log4j/2.0/manual/markers.html has more background, that's for direct log4j, but should be the same through slf4j.) Tx, M. -- Michael Vorburger, Red Hat vorbur...@redhat.com | IRC: vorburger @freenode | ~ = http://vorburger.ch On Thu, Nov 22, 2018 at 10:13 AM SOMASHEKHAR MANOHARA JAVALAGI < somashekhar.manohara.javal...@ericsson.com> wrote: > Hi Michael, > > > > I am trying to filter out openflow event logs by adding marker filter. > > My marker is used as below with help of class level Logger . > > > Marker *marker *= MarkerFactory.*getMarker*(*"OfEventLog"*); > > *LOG*.info(*marker*, *"Connect, Node: {}"*, featureOutput.getDatapathId()) > > > > With og.ops4j.pax.logging configuration > > > > log4j2.appender.ofp.type = RollingRandomAccessFile > > log4j2.appender.ofp.append = true > > log4j2.appender.ofp.fileName = \${karaf.data}/events/openflow/openflow.log > > log4j2.appender.ofp.filePattern = > \${karaf.data}/events/openflow/openflow.log.%i > > log4j2.appender.ofp.name = ofp > > log4j2.appender.ofp.layout.type = PatternLayout > > log4j2.appender.ofp.layout.pattern = %d{ISO8601} | %m%n > > log4j2.appender.ofp.policies.type = Policies > > log4j2.appender.ofp.policies.size.type = SizeBasedTriggeringPolicy > > log4j2.appender.ofp.policies.size.size = 8MB > > log4j2.appender.ofp.strategy.max = 10 > > log4j2.appender.ofp.strategy.type = DefaultRolloverStrategy > > > > log4j2.appender.ofp.filter.marker.type = MarkerFilter > > log4j2.appender.ofp.filter.marker.onMatch = ACCEPT > > log4j2.appender.ofp.filter.marker.onMisMatch = DENY > > log4j2.appender.ofp.filter.marker.marker =OfEventLog > > > > > > log4j2.rootLogger.ofp.level = INFO > > log4j2.rootLogger.ofp.additivity = false > > log4j2.rootLogger.appenderRef.ofp.ref = ofp > > > > I am able to redirect logs to the mentioned file(this I have tested by making > onMisMatch=ACCEPT), but my marked log is never filtered. > > Can you please correct me, if you have ever faced this? > > > > Regards, > > Somashekhar > > > > > > > > *From:* Gerrit Code Review [mailto:ger...@opendaylight.org] > *Sent:* Thursday, November 15, 2018 6:27 PM > *To:* SOMASHEKHAR MANOHARA JAVALAGI < > somashekhar.manohara.javal...@ericsson.com> > *Cc:* D Arunprakash <d.arunprak...@ericsson.com>; jenkins-releng < > jenkins-rel...@opendaylight.org>; Gobinath . <gobin...@ericsson.com>; > Anil Vishnoi <vishnoia...@gmail.com> > *Subject:* Change in openflowplugin[master]: OPNFLWPLUG-644: Openflow > Event logging using log4j > > > > Michael Vorburger *posted comments* on this change. > > View Change <https://git.opendaylight.org/gerrit/75415> > > Patch set 10:Code-Review -1 > > instead of using a separate Logger, using the slf4j Marker concept would > be nicer. (FYI we've had a similiar discussion in genius a few months ago, > ask your colleagues.) > > To view, visit change 75415 <https://git.opendaylight.org/gerrit/75415>. > To unsubscribe, visit settings > <https://git.opendaylight.org/gerrit/settings>. > > Gerrit-Project: openflowplugin > > Gerrit-Branch: master > > Gerrit-MessageType: comment > > Gerrit-Change-Id: I5e86e58fb4fcbd8048dae4fea92f2021bfdbdd04 > > Gerrit-Change-Number: 75415 > > Gerrit-PatchSet: 10 > > Gerrit-Owner: Somashekhar Javalagi < > somashekhar.manohara.javal...@ericsson.com> > > Gerrit-Reviewer: Anil Vishnoi <vishnoia...@gmail.com> > > Gerrit-Reviewer: Arunprakash D <d.arunprak...@ericsson.com> > > Gerrit-Reviewer: Gobinath Suganthan <gobin...@ericsson.com> > > Gerrit-Reviewer: Michael Vorburger <vorbur...@redhat.com> > > Gerrit-Reviewer: Somashekhar Javalagi < > somashekhar.manohara.javal...@ericsson.com> > > Gerrit-Reviewer: jenkins-releng <jenkins-rel...@opendaylight.org> > > Gerrit-Comment-Date: Thu, 15 Nov 2018 12:56:51 +0000 > > Gerrit-HasComments: No >
_______________________________________________ openflowplugin-dev mailing list openflowplugin-dev@lists.opendaylight.org https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev