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 C66BB200C7F for ; Wed, 24 May 2017 18:20:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C523C160BB4; Wed, 24 May 2017 16:20:14 +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 E55B9160B9C for ; Wed, 24 May 2017 18:20:13 +0200 (CEST) Received: (qmail 64517 invoked by uid 500); 24 May 2017 16:20:13 -0000 Mailing-List: contact dev-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 dev@karaf.apache.org Received: (qmail 64503 invoked by uid 99); 24 May 2017 16:20:12 -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; Wed, 24 May 2017 16:20:12 +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 72C0F1A7ABA for ; Wed, 24 May 2017 16:20:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 J0DDRX0koXog for ; Wed, 24 May 2017 16:20:08 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1D5295F306 for ; Wed, 24 May 2017 16:20:08 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id a5so56934560lfh.2 for ; Wed, 24 May 2017 09:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=+cYO6NmtcHSq1GgmiTOPhdvsqY3E4sVnZPD98oqzUXE=; b=r/wdc6SQnF7gt0iVsDb99Rw1M5fYDNFyHnA+AIk754Nv6Ps0hSfiujpo87DJlSeZkU /GZVnbklUcFaUIEiDlQA77F52F9+GlW+gVkU/56sLsNhBQypgmkn2YFDe8EVe2aQWnKC e+8zbN3q8bCdXMunJgpH4z6jx2u2r948JKHOxInL+Y3wpgImtHqPixXeVKJSNa8wEdzW wCzJRVkPABY6wIg07M0TMJVCfGQ9Y/dlSmF9pq4rURjJaK1GBVfzGMmu96BG2oaMLD8F sARedmCP1F3eLrpvCg1E5aPNgO9Qo4sHxFIghsgnhZ+ck1AGGsrCqTI11DW/pT1yvhK0 ++IQ== 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=+cYO6NmtcHSq1GgmiTOPhdvsqY3E4sVnZPD98oqzUXE=; b=GwQ3bubtHhPSwV7x1dydkNCx6rW2Wk0BPgCRWBnkRVcvNRkvoUDaXbv74RXe4KvCLJ we2I0AOfONF/yoyfXw4oNzIZtUqfQ+qqGDU649xwrujxABPZsy20yTy9m/9/Gk7lwbDU ZvDrOB3cpjmQF78hhwNyfIM9SpwpnH3Sflj/ghsaByMLZ1uLPj35bjEwzScI70c5KZCR CjTvIxgMT92isCKRl1LhWAdVkV9BHxEx6+xWSGY/GhQO8nPU/w7bkW6F3JhcZV4+VF6M Itb6Y6WT/q1HTpoS2KIiEjD6gCBfx7f5W7JodsaWpGaZAfG53WFOE9vUA3GOyFvQPcNF pM6A== X-Gm-Message-State: AODbwcCQeccGKhkMcYslGmg2JEwowTp0TtQ1iLlmuqwRaZKUAOnMOp/R Z7G9+KblHXAjuZj64ABegjw3aWAdbw== X-Received: by 10.46.19.2 with SMTP id 2mr10635138ljt.132.1495642807302; Wed, 24 May 2017 09:20:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.37.129 with HTTP; Wed, 24 May 2017 09:20:06 -0700 (PDT) In-Reply-To: References: From: Matt Sicker Date: Wed, 24 May 2017 11:20:06 -0500 Message-ID: Subject: Re: Using Custom Layout for Log4j2 in Karaf 4.1.x... To: Karaf Developers List Content-Type: multipart/alternative; boundary="94eb2c1ce9283d831e0550477ac2" archived-at: Wed, 24 May 2017 16:20:15 -0000 --94eb2c1ce9283d831e0550477ac2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It could be a bug in log4j2 itself rather than pax-logging. I worked on some OSGi support in log4j2 a while back, and I'm not sure if this is a new issue or an existing one. On 24 May 2017 at 05:43, James Carman wrote: > I tried adding pax-logging-service to startup.properties (after putting i= t > into the system repo) and I still have the issue. So, the ultimate issue > isn't the fragment host necessarily. My issue is that it can't fine my > custom layout class. I've tried using the name from the @Plugin annotatio= n. > I've tried using the fully-qualified class name. Nothing seems to work. > Here's the declaration of my layout: > > @Plugin(name =3D "MyJsonLayout", category =3D Node.CATEGORY, elementType = =3D > Layout.ELEMENT_TYPE, printObject =3D true) > public class MyJsonLayout extends AbstractStringLayout { > ... > } > > and here's what I've changed in the logging config file: > > log4j2.rootLogger.appenderRef.RollingFile.ref =3D RollingFile > # Rolling file appender > log4j2.appender.rolling.type =3D RollingRandomAccessFile > log4j2.appender.rolling.name =3D RollingFile > log4j2.appender.rolling.fileName =3D ${karaf.home}/log/aetos.log > log4j2.appender.rolling.filePattern =3D ${karaf.home}/log/aetos.log.%i > # uncomment to not force a disk flush > log4j2.appender.rolling.immediateFlush =3D false > log4j2.appender.rolling.append =3D true > log4j2.appender.rolling.layout.type =3D com.myco.log4j.json.MyJsonLayout > log4j2.appender.rolling.policies.type =3D Policies > log4j2.appender.rolling.policies.size.type =3D SizeBasedTriggeringPolicy > log4j2.appender.rolling.policies.size.size =3D 200MB > > As I said, I tried just using layout.type =3D MyJsonLayout, but that does= n't > work either. Do we have an example where something like this works that = I > can reverse engineer? > > Thanks, > > James > > On Tue, May 23, 2017 at 7:03 PM James Carman > wrote: > > > I am trying to use a custom layout and I'm following the examples (I > > think). We had one that worked in Karaf 3.0.x. Anyway, I set up the > > fragment host like this: > > > > > > org.apache.felix > > maven-bundle-plugin > > 3.3.0 > > true > > true > > > > > > > > org.ops4j.pax.logging.pax-logging-service > > > > > > > > > > However, my bundle will not resolve this way. I don't see that bundle > > being loaded in Karaf 4.1.1: > > karaf@root()> list -t 0 -s | grep -i log 19:01:18 > > 5 =E2=94=82 Active =E2=94=82 8 =E2=94=82 1.9.1 =E2=94=82 org.ops4j.pax= .logging.pax-logging-api > > 6 =E2=94=82 Active =E2=94=82 8 =E2=94=82 1.9.1 =E2=94=82 org.ops4j.pax= .logging.pax-logging-log4j2 > > 36 =E2=94=82 Active =E2=94=82 30 =E2=94=82 4.1.1 =E2=94=82 org.apache.k= araf.log.core > > > > I tried binding to "org.ops4j.pax.logging.pax-logging-api", but that > > didn't work either. Did this process change for 4.1.x? > > > --=20 Matt Sicker --94eb2c1ce9283d831e0550477ac2--