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 313D1200B29 for ; Thu, 16 Jun 2016 02:05:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2FC89160A5D; Thu, 16 Jun 2016 00:05:11 +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 4C824160A4D for ; Thu, 16 Jun 2016 02:05:10 +0200 (CEST) Received: (qmail 71534 invoked by uid 500); 16 Jun 2016 00:05:09 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 71522 invoked by uid 99); 16 Jun 2016 00:05:09 -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; Thu, 16 Jun 2016 00:05:09 +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 C66EBC22E9 for ; Thu, 16 Jun 2016 00:05:08 +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-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id pSH6PhL4myB5 for ; Thu, 16 Jun 2016 00:05:07 +0000 (UTC) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com [209.85.214.52]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 90A825F296 for ; Thu, 16 Jun 2016 00:05:06 +0000 (UTC) Received: by mail-it0-f52.google.com with SMTP id a5so122125514ita.1 for ; Wed, 15 Jun 2016 17:05:06 -0700 (PDT) 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=kuxa5tqfqsfbj+kun89zPNBpFExjUink5gcU/fCVN9U=; b=nPSGuG3DwbkiPwa+CHCoPO6RpM9bxZjU/Ytg0CjqmWJo08I1LUswTMsoioMh1JStbe UNE0y/NwsKaZ2+pd0lNrTVy1sCjg06sM0+HayC/RZ0+RkkgM5ydCaTY8YveLZmsgwvNV 2yfXtGPBefOiM23PYUQu1RhI23QiehACBVEj7e9iHo/Ttr8+8vCSyE8nawip5irZz/Nv 3BtuHA2Ox2oOERtMgLdu+YQ0lhWm3hFeBOiclq5ZetzTlqoXhoaypnxrYDDJj6yudnYT HwRFsjffezTU1O8Q23jbaTab9oA0d3E/OfQo8MmzIy5odkbsVAhiPJtVo1VdYRCUjwgh eYeA== 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=kuxa5tqfqsfbj+kun89zPNBpFExjUink5gcU/fCVN9U=; b=iiUCnygKxGi36GJUIhtUrsC+TXqeCwpKw+CGrngFNQcRMiTykRPbIYCKsYYep6BMAF W+lS48R6iqkhRB9Fk8G0YLwuwLapysxunwUb22MTsYjgVTrv2Ol5sfnK074X8Rc8Lb8g sR15Kr7Mb5+MujdVqEr0XabvAJBt+r/aWCFB/A2PvhRGPNrrqkgSMWAiuRmwCwjDtRNc 7xgsFdY6riYbHgqrOsuOfOsDlHygx/DtGC4mXe3vb2gFcVGur2tYhOkavAoZixSDw0bw bAD6pv/l9J2GMW61o/mhSKvRAIhGoPF55vQfBmSQlDKfkj3J0Fo6wYajbYX5czLb28H/ N51Q== X-Gm-Message-State: ALyK8tJDiHVgDTn8cQSAtPSJkpiZB1C1kSRdn7L4C7BJ+bB/oq29KTLYX1pjJKjZ957ze9+Orn2sJ/JVMZmCaA== MIME-Version: 1.0 X-Received: by 10.36.36.4 with SMTP id f4mr3366462ita.29.1466035505396; Wed, 15 Jun 2016 17:05:05 -0700 (PDT) Received: by 10.64.69.167 with HTTP; Wed, 15 Jun 2016 17:05:05 -0700 (PDT) Received: by 10.64.69.167 with HTTP; Wed, 15 Jun 2016 17:05:05 -0700 (PDT) In-Reply-To: <7D1BF36B-50AC-41FF-BA7B-70C894B41BAB@gmail.com> References: <7D1BF36B-50AC-41FF-BA7B-70C894B41BAB@gmail.com> Date: Wed, 15 Jun 2016 20:05:05 -0400 Message-ID: Subject: Re: OnStartupTriggeringPolicy/custom header From: Leon Finker To: Log4J Users List Content-Type: multipart/alternative; boundary=001a1147452887021a053559fd20 archived-at: Thu, 16 Jun 2016 00:05:11 -0000 --001a1147452887021a053559fd20 Content-Type: text/plain; charset=UTF-8 As I remember they are not visible (protected). On Jun 15, 2016 7:59 PM, "Remko Popma" wrote: > I would not use the drain(ByteBuffer) method directly because it would > cause that message to appear in the log file ahead of the messages that are > currently in the buffer but haven't been flushed yet. > > Have you looked at the parent OutputStreamManager class? > Why not use one of the write(byte[], ...) methods? They correctly append > to any existing messages. > > Remko > > Sent from my iPhone > > > On 2016/06/16, at 2:40, Ralph Goers wrote: > > > > Yes, the drain method should write whatever is in the ByteBuffer to the > file. > > > > Ralph > > > >> On Jun 15, 2016, at 9:34 AM, Leon Finker wrote: > >> > >> An option to roll even empty files would be great. Because in our case > we always want to roll the previous log file. > >> > >>> Actually, the triggering policy could write to the file since it has > access to the Manager. > >> > >> I've looked through all the possible methods on RollingFileManager and > nothing jumped out that allows us to write to the log file. I only see > drain(ByteBuffer), is that the one to use? Writing from triggering policy > seems to be the easiest way in our case. > >> > >>> On 2016-06-15 12:25 (-0400), Ralph Goers > wrote: > >>> I can add an option to the OnStartupTriggeringPolicy to only roll if > the file meets or exceeds a minimum value. The default would be 1 byte. > >>> > >>> Also, I believe I introduced another bug. The file is now going to > roll every time a reconfiguration takes place, which is obviously > incorrect. I need to fix that asap. > >>> > >>> The PatternLayout does not support interpolation of the header and > footer but the Configuration does. All attributes are interpolated as the > configuration is read. You could create your own custom Lookup to get the > processId, but that may be something we should add to the standard set of > properties. > >>> > >>> Actually, the triggering policy could write to the file since it has > access to the Manager. > >>> > >>> Ralph > >>> > >>> > >>> > >>>> On Jun 15, 2016, at 8:17 AM, Leon Finker wrote: > >>>> > >>>> Hi, > >>>> > >>>> What would be the best way to implement the following: > >>>> 1. Always roll log file once on JVM startup (and only on JVM > startup). - This could be done with implementing another > OnStartupTriggeringPolicy (the one from 2.6.1+ doesn't roll empty files > anymore). > >>>> 2. Log an entry in the new log file (after the roll) with something > like: > >>>> Constants.LINE_SEPARATOR + "---------- " + DateTime.now() + " > STARTING " + service_instance_Name + " " + getProcessId() + " ----------" > >>>> - Does PatternLayout's header support system property lookup > variables (i.e.: service instance name and date time now)? > >>>> - Not sure how to allow for custom method call to get the > getProcessId() into the header > >>>> - It could've been easy if I could do it from > OnStartupTriggeringPolicy, but there is no way to write to the new rolled > log file from there. > >>>> > >>>> Is there a way? > >>>> > >>>> Thank you > >>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > >>>> For additional commands, e-mail: log4j-user-help@logging.apache.org > >>> > >>> > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > >>> For additional commands, e-mail: log4j-user-help@logging.apache.org > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > >> For additional commands, e-mail: log4j-user-help@logging.apache.org > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > > For additional commands, e-mail: log4j-user-help@logging.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-user-help@logging.apache.org > > --001a1147452887021a053559fd20--