[logback-dev] [JIRA] Updated: (LBCLASSIC-295) MarkerFilter doesn't recognize nested markers.
Paolo Mazzoncini (JIRA)
noreply-jira at qos.ch
Mon Sep 12 18:33:16 CEST 2011
[ http://jira.qos.ch/browse/LBCLASSIC-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paolo Mazzoncini updated LBCLASSIC-295:
---------------------------------------
Attachment: compositeMarker.patch
The complete patch
> MarkerFilter doesn't recognize nested markers.
> ----------------------------------------------
>
> Key: LBCLASSIC-295
> URL: http://jira.qos.ch/browse/LBCLASSIC-295
> Project: logback-classic
> Issue Type: Bug
> Components: Other
> Affects Versions: 0.9.29
> Environment: MacOsx, Jdk 1.6 update 26
> Reporter: Paolo Mazzoncini
> Assignee: Logback dev list
> Attachments: compositeMarker.patch
>
>
> I was trying to use nested markers to organize my logs in a better (maybe) way.
> But the MarkerFilter (ch.qos.logback.classic.turbo.MarkerFilter) did not treat nested (or composite) markers as I expect.
> Here a test that shows this issue, this test can be appended to ch.qos.logback.classic.turbo.MarkerFilterTest:
> @Test
> public void testComposite(){
> String compositeMarkerName = "compositeMarker";
> Marker compositeMarker=MarkerFactory.getMarker(compositeMarkerName);
> compositeMarker.add(totoMarker);
>
> MarkerFilter mkt = new MarkerFilter();
> mkt.setMarker(MARKER_NAME);
> mkt.setOnMatch("ACCEPT");
> mkt.setOnMismatch("DENY");
>
> mkt.start();
>
> assertTrue(mkt.isStarted());
> assertEquals(FilterReply.DENY, mkt.decide(null, null, null, null, null, null));
> assertEquals(FilterReply.ACCEPT, mkt.decide(totoMarker, null, null, null, null, null));
> assertEquals(FilterReply.ACCEPT, mkt.decide(compositeMarker, null, null, null, null, null));
> }
> The solution that I found is pretty simple, here is the patch:
> diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
> index 8e133cb..434b035 100644
> --- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
> +++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
> @@ -47,7 +47,7 @@ public class MarkerFilter extends MatchingFilter {
> return onMismatch;
> }
>
> - if(markerToMatch.contains(marker)) {
> + if(marker.contains(markerToMatch)) {
> return onMatch;
> } else {
> return onMismatch;
> --
> 1.7.5.4
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list