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 52209199B8 for ; Wed, 2 Mar 2016 00:50:53 +0000 (UTC) Received: (qmail 38100 invoked by uid 500); 2 Mar 2016 00:50:53 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 38053 invoked by uid 500); 2 Mar 2016 00:50:52 -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 38043 invoked by uid 99); 2 Mar 2016 00:50:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2016 00:50:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8208FC39FA for ; Wed, 2 Mar 2016 00:50:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id sitRajWZZ36w for ; Wed, 2 Mar 2016 00:50:51 +0000 (UTC) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 2E8B65F33F for ; Wed, 2 Mar 2016 00:50:50 +0000 (UTC) Received: by mail-ob0-f173.google.com with SMTP id fz5so52340522obc.0 for ; Tue, 01 Mar 2016 16:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=LzjbTvvQLSBUQdic7UCsuPJpjdFBJqDvyCF0GjSljls=; b=ohYrGn1YfEMxoVBmgWiTrxiU7HRcHHEVzwONaMOuwtgkXMY/399cztR6wN9U7+HFin k7ArSBtbdA1yXUdRt4vrwB8+ngB09bdMgq7ffN8gXVYiq152R2xeXqs5WOlRl43THci/ 9SlCbCCMsirW8U7v/rRoLgNq127sWZTIDTeqf9ev/V+2GB8ID1HdJw/8YU/h7sAuL9GZ ARQpWjqsseaY41cTCMGBKxHJ0GamgFu6oFfd4RfPnM0TOBTtLheVAnuSfHcCO/7g++0M b8n4a2/WtNt1+hd37wIDTXcW0aOmmM91zRleNHn6Orqm0lZS3Alc0hFd3p89cH1RmQ0F 6LSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=LzjbTvvQLSBUQdic7UCsuPJpjdFBJqDvyCF0GjSljls=; b=X7eJ8MEXZSKk6UL6xqMFvicTF1d1IcWJzvh6vmMqvjOQytBBXtWS17IEtGa7z6l6eC Z2y/3pR5UNGPGxynCxmeZBK2e6n48Gu7FY/fYR/pAtWQHdYU1PJv+xWDek/bSOM4yfeS ey8ftW5Fi1eFyhomHgGcWv29N8kyBm34oxRJ/LqNwurn19svKkV3PRzpJG2tcR3Nsmf7 8w1TYborTGiHOvkSCj1XcNVDD4warY5nal2D45y0cHl6T06xgIHrIbt7iXVOpeGgHdly h2r0KeyhiryZV+phIGoky1myxP2MX6SYht/5+nXXU/mwmLqpvAGemNPbVc1iFH3Y4DS4 iETg== X-Gm-Message-State: AD7BkJKRBjjWi0QloM+zIZXJFqux1tqDvLVg8GiTcx4s7lhEWwFcM7lgyUOcfajJXMK/hgAYzOgtuID50Oa0/Q== MIME-Version: 1.0 X-Received: by 10.60.162.102 with SMTP id xz6mr19387878oeb.62.1456879843598; Tue, 01 Mar 2016 16:50:43 -0800 (PST) Received: by 10.157.46.43 with HTTP; Tue, 1 Mar 2016 16:50:43 -0800 (PST) In-Reply-To: <4C06BBE2-B4D2-4532-AC3F-7778853EF601@dslextreme.com> References: <983B86D4-EA17-43DD-87D5-48B7185B5381@dslextreme.com> <4C06BBE2-B4D2-4532-AC3F-7778853EF601@dslextreme.com> Date: Tue, 1 Mar 2016 16:50:43 -0800 Message-ID: Subject: Re: Multiple Markers vs. Marker multiple inheritance. From: Gary Gregory To: Log4J Developers List Content-Type: multipart/alternative; boundary=047d7b2e75fe8ee9dc052d064581 --047d7b2e75fe8ee9dc052d064581 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Ralph, Thank you for shedding light on this use case. I think we are close but I still am doubtful/puzzled. I have a class with logger calls scattered all over, something like: logger.throwing(ex1); ... logger.debug(...); ... logger.throwing(ex2); .... logger.warn(GaryMarker, "...", objects); // GARY_MARKER ... logger.throwing(ex3); // GARY_MARKER (?) .... logger.warn("...", objects); ... logger.throwing(ex4); .... What I want is do deny log events originating from lines commented with // GARY_MARKER. If I define (1) GARY and (2) GARY_THROWING to inherit from THROWING, would this work? Wouldn't I deny all the other throwing()s? Thank you, Gary On Tue, Mar 1, 2016 at 4:39 PM, Ralph Goers wrote: > From that use case you also wouldn=E2=80=99t want GARY to have THROWING a= s a > parent since that isn=E2=80=99t always the case. You could create GARY_T= HROWING > that has both as parents. If you deny GARY before THROWING is checked th= e > event will be denied. > > Ralph > > On Mar 1, 2016, at 5:35 PM, Gary Gregory wrote: > > I did not make my use case clear enough perhaps. I have one log event > logged with warn() and a custom marker, say "GARY". I have a second log > event logged with throwing() which internally uses the "THROWING" marker. > > I was hopping to filter on the same marker "GARY", but how? > > The only way I thought to do this now is for my custom marker to inherit > from the Log4j Core "THROWING" marker, but that won't even work since > filtering on "GARY" will not deny "THROWING". > > Thoughts? > > Gary > > On Tue, Mar 1, 2016 at 4:29 PM, Ralph Goers > wrote: > >> I don=E2=80=99t see the point of accepting an array of Markers since you= can >> always create a Marker that has multiple parents - effectively making it= an >> array of Markers. However, this relationship is meant to be permanent - >> which makes sense to me since you should only be using a Marker to mean = a >> single thing in an application. >> >> What I don=E2=80=99t really understand is how one FooException is =E2=80= =9Csofter=E2=80=9D than >> another FooException. I do understand how throwing a Type1Exception mig= ht >> be more significant than a Type2Exception, but that might be better >> expressed in the Exception hierarchy than in Markers. >> >> I could certainly see creating an ExceptionPatternSelector that uses a >> PatternLayout that only prints the exception message for some exceptions >> and prints the stack trace for others. >> >> I suppose I could also see creating an ExceptionFilter that filters base= d >> on the exception type. >> >> I guess it just feels wrong to me for a developer to have to add a Marke= r >> to an exception event to somehow add more significance to the event. >> >> Ralph >> >> On Mar 1, 2016, at 4:24 PM, Gary Gregory wrote: >> >> Hi All: >> >> Is the following an odd-ball use case or a super-niche use case, and >> should we do anything about it. >> >> I have a part of our app that throws and logs an exception with the usua= l: >> >> logger.throwing(new FooException(...)); >> >> Elsewhere in this class and in the same method, I have softer errors for >> which I log a warning with a a custom marker. >> >> What I really want is to be able to filter out both log events based on >> this marker but not other kinds of events, hence the use of Markers. >> >> I cannot say: >> >> logger.throwing(myMarker, new FooException(...)); >> >> Our implementation marks throwing() log event (helpfully) with its >> own THROWING_MARKER. >> >> I could make my custom marker a child of THROWING_MARKER, but that is >> really not semantically correct, is smelly and therefore a nasty hack IM= O. >> >> If I had a logger.throwing(Marker, Throwable); API, how would it work? >> >> I would say that LogEvent should hold an array of Markers, not a single >> one. >> >> What does this sound like to you all? Craziness or a power-user >> refinement? >> >> Let's only consider throwing() for now before we even think about adding >> Logger APIs that take Marker[]s. >> >> Gary >> >> >> -- >> E-Mail: garydgregory@gmail.com | ggregory@apache.org >> Java Persistence with Hibernate, Second Edition >> >> JUnit in Action, Second Edition >> Spring Batch in Action >> Blog: http://garygregory.wordpress.com >> Home: http://garygregory.com/ >> Tweet! http://twitter.com/GaryGregory >> >> >> > > > -- > E-Mail: garydgregory@gmail.com | ggregory@apache.org > Java Persistence with Hibernate, Second Edition > > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > > > --=20 E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --047d7b2e75fe8ee9dc052d064581 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Ralph,

Thank you for shedding light = on this use case.

I think we are close but I still= am doubtful/puzzled. I have a class with logger calls scattered all over, = something like:

logger.throwing(ex1);
..= .
logger.debug(...);
...
logger.throwing(ex2)= ;
....
logger.warn(GaryMarker, "...", objects= ); // GARY_MARKER
...
logger.throwing(ex3); // GAR= Y_MARKER (?)
....
logger.warn("..."= ;, objects);=C2=A0
...
logger.throwing(ex4);=
....

What I want is do deny log e= vents originating from lines commented with //=C2=A0GARY_MARKER.
=
If I define (1) GARY and (2) GARY_THROWING to inherit from T= HROWING, would this work? Wouldn't I deny all the other throwing()s?

Thank you,
Gary

=

On Tue, Mar 1, 20= 16 at 4:39 PM, Ralph Goers <ralph.goers@dslextreme.com> wrote:
From that use case you also wouldn=E2=80=99t want GARY to have = THROWING as a parent since that isn=E2=80=99t always the case.=C2=A0 You co= uld create GARY_THROWING that has both as parents.=C2=A0 If you deny GARY b= efore THROWING is checked the event will be denied.

Ralph
<= div>

On Mar 1, 201= 6, at 5:35 PM, Gary Gregory <garydgregory@gmail.com> wrote:

I did not make my use case clear enough perhaps. I have one log = event logged with warn() and a custom marker, say "GARY". I have = a second log event logged with throwing() which internally uses the "T= HROWING" marker.

I was hopping to filter on the sam= e marker "GARY", but how?

The only way I= thought to do this now is for my custom marker to inherit from the Log4j C= ore "THROWING" marker, but that won't even work since filteri= ng on "GARY" will not deny "THROWING".
Thoughts?

Gary

On Tue, Mar 1, 2016 at 4:29= PM, Ralph Goers <ralph.goers@dslextreme.com> wrote= :
I don=E2=80=99t see the point of accepting an array of Markers since you = can always create a Marker that has multiple parents - effectively making i= t an array of Markers.=C2=A0 However, this relationship is meant to be perm= anent - which makes sense to me since you should only be using a Marker to = mean a single thing in an application.

What I don= =E2=80=99t really understand is how one FooException is =E2=80=9Csofter=E2= =80=9D than another FooException.=C2=A0 I do understand how throwing a Type= 1Exception might be more significant than a Type2Exception, but that might = be better expressed in the Exception hierarchy than in Markers.=C2=A0
=

I could certainly see creating an ExceptionPatternSelec= tor that uses a PatternLayout that only prints the exception message for so= me exceptions and prints the stack trace for others.

I suppose I could also see creating an ExceptionFilter that filters base= d on the exception type.

I guess it just feels wro= ng to me for a developer to have to add a Marker to an exception event to s= omehow add more significance to the event.

Ralph

On Mar 1, 2016, at 4:24 PM, Gary Gregory <garydgregory@gmail.com= > wrote:

Hi All:

I= s the following an odd-ball use case or a super-niche use case, and should = we do anything about it.

I have a part of our app that t= hrows and logs an exception with the usual:

logger= .throwing(new FooException(...));

Elsewhere in thi= s class and in the same method, I have softer errors for which I log a warn= ing with a a custom marker.

What I really want is = to be able to filter out both log events based on this marker but not other= kinds of events, hence the use of Markers.

I cann= ot say:

logger.throwing(myMarker, new FooException= (...));=C2=A0

Our implementation marks=C2=A0throwi= ng()=C2=A0log event (helpfully) with its own=C2=A0THROWING_MARKER.

I could make my custom marker a child of=C2=A0THROWING_MAR= KER, but that is really not semantically correct, is smelly and therefore a= nasty hack IMO.

If I had a logger.throwing(Marker= , Throwable); API, how would it work?

I would say = that LogEvent should hold an array of Markers, not a single one.
=
What does this sound like to you all? Craziness or a power-u= ser refinement?

Let's only consider throwing()= for now before we even think about adding Logger APIs that take Marker[]s.=

Gary




--




--
--047d7b2e75fe8ee9dc052d064581--