From issues-return-39937-archive-asf-public=cust-asf.ponee.io@karaf.apache.org Mon Jun 11 18:46:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BC3A2180789 for ; Mon, 11 Jun 2018 18:46:06 +0200 (CEST) Received: (qmail 7259 invoked by uid 500); 11 Jun 2018 16:46:05 -0000 Mailing-List: contact issues-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list issues@karaf.apache.org Received: (qmail 7151 invoked by uid 99); 11 Jun 2018 16:46:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2018 16:46:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 4E96618171B for ; Mon, 11 Jun 2018 16:46:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Xz5B3sEeNVdt for ; Mon, 11 Jun 2018 16:46:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C085C5F57D for ; Mon, 11 Jun 2018 16:46:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 9F384E02ED for ; Mon, 11 Jun 2018 16:46:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B985C21804 for ; Mon, 11 Jun 2018 16:46:00 +0000 (UTC) Date: Mon, 11 Jun 2018 16:46:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@karaf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KARAF-5747) Add append file capability in decanter-appender-file 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/KARAF-5747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16508346#comment-16508346 ] ASF GitHub Bot commented on KARAF-5747: --------------------------------------- jbonofre closed pull request #34: [KARAF-5747] Add append file capability in decanter-appender-file URL: https://github.com/apache/karaf-decanter/pull/34 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/appender/file/src/main/cfg/org.apache.karaf.decanter.appender.file.cfg b/appender/file/src/main/cfg/org.apache.karaf.decanter.appender.file.cfg index ee487cb..78a86c3 100644 --- a/appender/file/src/main/cfg/org.apache.karaf.decanter.appender.file.cfg +++ b/appender/file/src/main/cfg/org.apache.karaf.decanter.appender.file.cfg @@ -6,4 +6,7 @@ #filename=${karaf.data}/decanter # Marshaller -marshaller.target=(dataFormat=csv) \ No newline at end of file +marshaller.target=(dataFormat=csv) + +# Append file +#append=true \ No newline at end of file diff --git a/appender/file/src/main/java/org/apache/karaf/decanter/appender/file/FileAppender.java b/appender/file/src/main/java/org/apache/karaf/decanter/appender/file/FileAppender.java index f916eff..713d9fa 100644 --- a/appender/file/src/main/java/org/apache/karaf/decanter/appender/file/FileAppender.java +++ b/appender/file/src/main/java/org/apache/karaf/decanter/appender/file/FileAppender.java @@ -43,10 +43,13 @@ private BufferedWriter writer; + private boolean append; + @Activate public void activate(ComponentContext componentContext) throws Exception { Dictionary config = componentContext.getProperties(); String filename = (config.get("filename") != null) ? (String) config.get("filename") : System.getProperty("karaf.data") + File.separator + "decanter"; + append = (config.get("append") != null) ? Boolean.parseBoolean((String) config.get("append")) : true; open(filename); } @@ -54,7 +57,7 @@ public void open(String filename) throws Exception { File file = new File(filename); file.getParentFile().mkdirs(); file.createNewFile(); - this.writer = new BufferedWriter(new FileWriter(file)); + this.writer = new BufferedWriter(new FileWriter(file, append)); } @Override ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org > Add append file capability in decanter-appender-file > ---------------------------------------------------- > > Key: KARAF-5747 > URL: https://issues.apache.org/jira/browse/KARAF-5747 > Project: Karaf > Issue Type: Improvement > Components: decanter > Reporter: Francois Papon > Assignee: Francois Papon > Priority: Minor > Fix For: decanter-2.1.0 > > > The file created by the appender is cleaned at bootstrapping if already exist. > The use could choose if the appender append or not in the file already exist. > We could add a new property in the configuration file of the appender. -- This message was sent by Atlassian JIRA (v7.6.3#76005)