Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 692AD200C61 for ; Tue, 11 Apr 2017 01:53:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 67B3D160BA5; Mon, 10 Apr 2017 23:53:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 86EAF160B99 for ; Tue, 11 Apr 2017 01:53:47 +0200 (CEST) Received: (qmail 95464 invoked by uid 500); 10 Apr 2017 23:53:46 -0000 Mailing-List: contact dev-help@apex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.apache.org Delivered-To: mailing list dev@apex.apache.org Received: (qmail 95452 invoked by uid 99); 10 Apr 2017 23:53:46 -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; Mon, 10 Apr 2017 23:53:46 +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 E6116CD3DA for ; Mon, 10 Apr 2017 23:53:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.287 X-Spam-Level: X-Spam-Status: No, score=-0.287 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=datatorrent-com.20150623.gappssmtp.com Received: from mx1-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 LCm5UAhjShL1 for ; Mon, 10 Apr 2017 23:53:43 +0000 (UTC) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 9705D5F3F0 for ; Mon, 10 Apr 2017 23:53:42 +0000 (UTC) Received: by mail-io0-f172.google.com with SMTP id r16so60315434ioi.2 for ; Mon, 10 Apr 2017 16:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datatorrent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=/N/mN2bjbMIeyo6qLJXL1vuIeqGZxwGstlfBDNsqURY=; b=cUzrt6qU1J7Y/pfaZ7AU/mKHsNU8g99NHVvVlcz1eZtzHDuaatMSE+u7xOtuimU9ty C1t9ttS63Hdr3EiGyFZjNTSeGxf08gswww7Ispy/ymIldPGBAXLpvm2LrZLeojY3gHKu jvGl8wX8tzfm397lZQvkIbcRkj+A3f67sFjhyFKHHv6Ilscc14goELI2rSvdkwyoW5by 3JWqtFoJNAYGYbbdRQvLb7RDpCfQjsgqKhYGUJnalM+tVopCxyVWoG92LA5FJxxkF8xu Fu6Tcs32dsgR0BjFX0XHO7BUhva4lIZBjbLTPB4cBwcoNSkZY/i984vlwQJgVpm7AprK jJrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=/N/mN2bjbMIeyo6qLJXL1vuIeqGZxwGstlfBDNsqURY=; b=BHRTAauSrKrCGRTVGv26N9jkjeTJvJcc5sDxncd8xKPq6kXFoMNOe/DD28wshsN4Cp a4ZNKwQMLzbKBxquCoD9UC5pY3wsucmhY+Dk9lv025MFgsNHUh00K2JD5maRs7Z2PrrV +pZ89gJUdRrUR84QIi7QydolozyhY7snj3PbliiIzLsFYIY9x3oPYRZb1GvgSKeL4/hj tKKkx7a9H5OPgeBd8++y7Brm1a13kKdx3h0zXacWH+kZtr2mLdwsdEHp5M+8IUs4D9hx 6vxIBNCtZCVe0NTANAxm8fmUyylwX/vwTboc6QXrVDEbfQzvsBI2Nr+xx8snZLv67qX8 l90A== X-Gm-Message-State: AN3rC/5HJo1OoCv8zswb14Od2u65H02IlSnEEsoM0qkjKWbH5WE2dRfhcPkwKWX2CilfBtB7E0UpcFBqtIUg44br X-Received: by 10.36.66.141 with SMTP id i135mr14685628itb.86.1491868421320; Mon, 10 Apr 2017 16:53:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.147.9 with HTTP; Mon, 10 Apr 2017 16:53:40 -0700 (PDT) In-Reply-To: References: <0864a4d6-995f-e636-470c-60c1c43d0621@datatorrent.com> <8e6122f3-8244-a7be-fbaa-0941b4697545@datatorrent.com> <5afc31ff-0fb7-0473-f3f7-4b732f829b4b@datatorrent.com> From: Munagala Ramanath Date: Mon, 10 Apr 2017 16:53:40 -0700 Message-ID: Subject: Re: Programmatic log4j appender in Apex To: dev@apex.apache.org Content-Type: multipart/alternative; boundary=001a1144a9624e07b6054cd8af91 archived-at: Mon, 10 Apr 2017 23:53:48 -0000 --001a1144a9624e07b6054cd8af91 Content-Type: text/plain; charset=UTF-8 Yes, totally agree, it would be helpful to have a detailed use case and/or a detailed spec of the desired capabilities -- not necessarily a complete spec but with enough detail to understand why existing capabilities are inadequate. Ram On Mon, Apr 10, 2017 at 4:43 PM, Vlad Rozov wrote: > It will be good to understand a use case where an operator needs a > specific appender. > > IMO, an operator designer defines *what* should be logged and dev-ops team > defines *where* to log. > > Thank you, > > Vlad > On 4/10/17 16:27, Munagala Ramanath wrote: > >> Yes, I understand, I was just wondering if individual operators could >> define the appenders >> they potentially need at compile time and then the operator callbacks >> could >> simply >> check the desired runtime condition and add the appropriate appender. >> >> Or are we saying there are scenarios where we absolutely cannot create the >> appender beforehand ? >> >> So broadly speaking, my question is whether the combination of providing >> predefined appenders >> and the PropertyConfigurator capabilities meets the need. >> >> Ram >> >> On Mon, Apr 10, 2017 at 2:18 PM, Sergey Golovko >> wrote: >> >> Ram, >>> >>> Really the new appender class must extend the abstract class >>> AppenderSkeleton. And in order to add a new appender programmatically in >>> Java, some code in Apex should call the following log4j method: >>> >>> org.apache.log4j.Logger.getRootLogger().addAppender(Appender >>> newAppender) >>> >>> The general idea of my proposal is "*based on some runtime parameter(s) >>> to >>> provide ability to create an appender instance via reflection and add it >>> to >>> the list of active log4j appenders*". >>> >>> Thanks, >>> Sergey >>> >>> >>> On Mon, Apr 10, 2017 at 2:04 PM, Vlad Rozov >>> wrote: >>> >>> It will require application recompilation and repackaging. The proposed >>>> functionality is for dev-ops to be able to route application logging to >>>> a >>>> preferred destination without recompiling applications. It is run-time >>>> configuration vs compile time hardcoded appender. >>>> >>>> Thank you, >>>> >>>> Vlad >>>> >>>> On 4/10/17 11:23, Munagala Ramanath wrote: >>>> >>>> You can do it in a trivial derived class without changing the base >>>>> >>>> class. >>> >>>> Ram >>>>> >>>>> On Mon, Apr 10, 2017 at 11:19 AM, Vlad Rozov >>>>> wrote: >>>>> >>>>> Does not the proposal to use Logger.addAppender() requires >>>>> modifications >>>>> >>>>>> to used operators code? >>>>>> >>>>>> Thank you, >>>>>> >>>>>> Vlad >>>>>> >>>>>> On 4/10/17 10:58, Munagala Ramanath wrote: >>>>>> >>>>>> People can currently do this by simply implementing the Appender >>>>>> >>>>>>> interface >>>>>>> and adding it >>>>>>> with Logger.addAppender() in the setup method. Why do we need >>>>>>> >>>>>> something >>> >>>> more elaborate ? >>>>>>> >>>>>>> Ram >>>>>>> >>>>>>> On Mon, Apr 10, 2017 at 10:30 AM, Sergey Golovko < >>>>>>> sergey@datatorrent.com> >>>>>>> wrote: >>>>>>> >>>>>>> The configuration of a log4j appender via log4j configuration file is >>>>>>> >>>>>> a >>> >>>> static configuration that cannot be disabled/enabled and managed >>>>>>>> dynamically by an application designer. The programmatic approach >>>>>>>> >>>>>>> will >>> >>>> allow an application designer to specify which of the available >>>>>>>> >>>>>>> log4j >>> >>>> appenders should be used for the specific application. >>>>>>>> >>>>>>>> It is not necessary Apex should use the predefined log4j appenders >>>>>>>> only. >>>>>>>> The log4j events contain useful but the very limited number of >>>>>>>> properties >>>>>>>> which values can be printed into output log4j sources. But based on >>>>>>>> >>>>>>> the >>> >>>> knowledge of the software product workflow, the custom defined log4j >>>>>>>> appender can extend a list of predefined output log events >>>>>>>> properties >>>>>>>> and, >>>>>>>> for instance for Apex, return: node, user name, application name, >>>>>>>> application id, container id, operator name, etc. >>>>>>>> >>>>>>>> Also the output log events that are generated by a custom defined >>>>>>>> >>>>>>> log4j >>> >>>> appender can be stored and indexed by any type of a full text search >>>>>>>> database. It will allow the customers and developers to simplify >>>>>>>> collection >>>>>>>> of log events statistics and searching/filtering of specific events >>>>>>>> >>>>>>> for >>> >>>> debugging and investigation. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Sergey >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Apr 10, 2017 at 6:34 AM, Vlad Rozov < >>>>>>>> v.rozov@datatorrent.com >>>>>>>> wrote: >>>>>>>> >>>>>>>> +1 Apex engine does not own log4j config file - it is provided >>>>>>>> either >>>>>>>> by >>>>>>>> >>>>>>>> Hadoop or an application. Hadoop log4j config does not necessarily >>>>>>>>> meet >>>>>>>>> application logging requirements, but if log4j is provided by an >>>>>>>>> application designer, who can only specify what to log, it may not >>>>>>>>> meet >>>>>>>>> operations requirements. Dev-ops should have an ability to specify >>>>>>>>> where >>>>>>>>> >>>>>>>>> to >>>>>>>>> >>>>>>>> log depending on the available infrastructure at run-time. >>>>>>>> >>>>>>>>> It will be good to have an ability not only specify extra log4j >>>>>>>>> appenders >>>>>>>>> at lunch time, but also at run-time, the same way how log4j logger >>>>>>>>> levels >>>>>>>>> may be changed. >>>>>>>>> >>>>>>>>> Thank you, >>>>>>>>> >>>>>>>>> Vlad >>>>>>>>> >>>>>>>>> On 4/9/17 23:14, Priyanka Gugale wrote: >>>>>>>>> >>>>>>>>> We can always write a custom appender and add it by changing root >>>>>>>>> appender >>>>>>>>> in log4j config file. Can you explain how adding appender >>>>>>>>> grammatically >>>>>>>>> >>>>>>>>> would help? >>>>>>>>>> >>>>>>>>>> -Priyanka >>>>>>>>>> >>>>>>>>>> On Sun, Apr 9, 2017 at 11:50 AM, Sanjay Pujare < >>>>>>>>>> sanjay@datatorrent.com >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Please give some examples and/or use cases of this programmatic >>>>>>>>>> >>>>>>>>> log4j >>> >>>> appender. >>>>>>>>>> >>>>>>>>>>> On Fri, Apr 7, 2017 at 8:40 PM, Sergey Golovko < >>>>>>>>>>> sergey@datatorrent.com >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Hi All, >>>>>>>>>>> >>>>>>>>>>> I'd like to add supporting of a custom defined log4j appender >>>>>>>>>>> that >>>>>>>>>>> >>>>>>>>>>>> can >>>>>>>>>>>> be >>>>>>>>>>>> added to Apex Application Master and Containers and be >>>>>>>>>>>> >>>>>>>>>>> configurable >>> >>>> programmatically. >>>>>>>>>>>> >>>>>>>>>>>> Sometimes it is not trivial to control log4j configuration via >>>>>>>>>>>> log4j >>>>>>>>>>>> properties. And I think the having of the approach to add a >>>>>>>>>>>> log4j >>>>>>>>>>>> >>>>>>>>>>>> appender >>>>>>>>>>>> >>>>>>>>>>>> programmatically will allow the customers and developers to >>>>>>>>>>> plugin >>>>>>>>>>> their >>>>>>>>>>> >>>>>>>>>>> own custom defined log4j appenders and be much flexible for >>>>>>>>>> >>>>>>>>> streaming >>> >>>> and >>>>>>>>>> >>>>>>>>>>> collection of Apex log events. >>>>>>>>>>>> >>>>>>>>>>>> I assume to provide generic approach for definition of the >>>>>>>>>>>> >>>>>>>>>>>> programmatic >>>>>>>>>>>> >>>>>>>>>>> log4j appender and to pass all configuration parameters >>>>>>>>>> including a >>>>>>>>>> name >>>>>>>>>> of >>>>>>>>>> the Java class with implementation of the log4j appender via >>>>>>>>>> system >>>>>>>>>> >>>>>>>>>>> and/or >>>>>>>>>>>> >>>>>>>>>>>> command line properties. >>>>>>>>>>> >>>>>>>>>>> Thanks, >>>>>>>>>>>> Sergey >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >> >> > -- _______________________________________________________ Munagala V. Ramanath Software Engineer E: ram@datatorrent.com | M: (408) 331-5034 | Twitter: @UnknownRam www.datatorrent.com | apex.apache.org --001a1144a9624e07b6054cd8af91--