Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 86BA511A33 for ; Sat, 5 Apr 2014 16:32:19 +0000 (UTC) Received: (qmail 57050 invoked by uid 500); 5 Apr 2014 16:32:18 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 56852 invoked by uid 500); 5 Apr 2014 16:32:18 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 56830 invoked by uid 99); 5 Apr 2014 16:32:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Apr 2014 16:32:15 +0000 Date: Sat, 5 Apr 2014 16:32:15 +0000 (UTC) From: "Ralph Goers (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-585) Markers not as powerful as slf4j MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LOG4J2-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13961145#comment-13961145 ] Ralph Goers commented on LOG4J2-585: ------------------------------------ No - I was referring to Bruce's suggestion to use a volatile reference to an array. I implemented that last night. The more I think about it the more I like the idea that parents added on the constructor cannot be removed. > Markers not as powerful as slf4j > -------------------------------- > > Key: LOG4J2-585 > URL: https://issues.apache.org/jira/browse/LOG4J2-585 > Project: Log4j 2 > Issue Type: Improvement > Components: API > Affects Versions: 2.0-rc1 > Reporter: Bruce Brouwer > Attachments: ConceptMarkerBenchmark.java, CurrentMarkerBenchmark.java, log4j2-585-concept.patch > > > Log4J's markers are not as flexible as markers in SLF4J. > First, SLF4J's markers are mutable. By allowing markers to be mutable, I can change the relationship of markers to each other based upon runtime or business conditions. > Second, and more importantly I think, is that essentially SLF4J markers have this parent/child relationship, much like Log4J, except that in SLF4J, I can essentially have a marker with multiple parents. For example, I might want this structure: > * Animal > ** Bird > *** Duck > ** Mammal > *** Bear > *** Dolphin > * Travels by > ** Water > *** Duck > *** Dolphin > ** Land > *** Duck > *** Bear > ** Air > *** Duck > Of course, this is a contrived example, but I wanted to describe the relationships. Now, if I wanted to filter based on markers that travel by Water for some appenders, and another appender wants to filter by Mammals, I can't simply use the single marker of Dolphin. > Either we need to reverse the marker relationship so that it contains its children, much like SLF4J, or we allow markers to have multiple parents, which I prefer because it could make it more succinct to define: > {code} > private static final Marker BY_LAND = MarkerManager.getMarker("BY_LAND"); > private static final Marker BY_WATER = MarkerManager.getMarker("BY_WATER"); > private static final Marker DUCK = MarkerManager.getMarker("DUCK", BY_LAND, BY_WATER); > {code} > As for the Marker API, we would either need to change getParent to getParents, or get rid of the getParent method from the API and just rely on the isInstanceOf method to handle checking multiple parents by looking at private member variables (my preference) -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org