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 52BCF200CBE for ; Fri, 7 Jul 2017 09:37:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4FA87168742; Fri, 7 Jul 2017 07:37:26 +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 9590916873F for ; Fri, 7 Jul 2017 09:37:25 +0200 (CEST) Received: (qmail 93563 invoked by uid 500); 7 Jul 2017 07:37:19 -0000 Mailing-List: contact user-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@karaf.apache.org Delivered-To: mailing list user@karaf.apache.org Received: (qmail 93553 invoked by uid 99); 7 Jul 2017 07:37:19 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jul 2017 07:37:19 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E16751A7B6D for ; Fri, 7 Jul 2017 07:37:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.001 X-Spam-Level: **** X-Spam-Status: No, score=4.001 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, KAM_LAZY_DOMAIN_SECURITY=1, RDNS_NONE=3] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id hsR8_BjdgHH1 for ; Fri, 7 Jul 2017 07:37:15 +0000 (UTC) Received: from blaine.gmane.org (unknown [195.159.176.226]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id C29CA5FBBA for ; Fri, 7 Jul 2017 07:37:14 +0000 (UTC) Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dTNov-00089L-Q0 for user@karaf.apache.org; Fri, 07 Jul 2017 09:36:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: user@karaf.apache.org To: user@karaf.apache.org From: Steinar Bang Subject: Re: How to get the karaf.log logging in a pax exam test with the karaf container? Date: Fri, 07 Jul 2017 09:37:03 +0200 Organization: Probably a good idea Lines: 33 Message-ID: <86a84gitpc.fsf@dod.no> References: <86tw2si02q.fsf@dod.no> <86eftvhxdi.fsf@dod.no> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/24.4 (windows-nt) Mail-Copies-To: never Cancel-Lock: sha1:MjJrzUaAfEiBHogDqyFMif1ZmsA= archived-at: Fri, 07 Jul 2017 07:37:26 -0000 >>>>> Steinar Bang : >>>>> Jean-Baptiste Onofr� : >> you can take about what we do in itest: >> https://github.com/apache/karaf/blob/master/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java >> You can see that we override the default pax-logging configuration >> with our own file: >> replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", >> getConfigFile("/etc/org.ops4j.pax.logging.cfg")), > Thanks! That worked! > Here's what I did > 1. Copied the above code into the pax exam setup options > 2. Copied the getConfigFile() method from the KarafTestSupport.java > file into my pax exam test > https://github.com/apache/karaf/blob/master/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java#L174 > 3. Copied the config file from the karaf test into > src/test/resources/etc in my pax exam project > https://github.com/apache/karaf/blob/master/itests/src/test/resources/etc/org.ops4j.pax.logging.cfg I forgot one thing: 4. Add keepRuntimeFolder() to the configuration options: https://github.com/apache/karaf/blob/master/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java#L197 > Then the resulting karaf.log file ended up as > target/exam//data/log/karaf.log Note that if keepRuntimeFolder() isn't set, the runtime is cleaned up at the end of the test, and karaf.log is gone.