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 9CB30200C53 for ; Tue, 11 Apr 2017 18:28:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9B4D3160B9B; Tue, 11 Apr 2017 16:28:38 +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 95781160B89 for ; Tue, 11 Apr 2017 18:28:37 +0200 (CEST) Received: (qmail 43934 invoked by uid 500); 11 Apr 2017 16:28:36 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 43923 invoked by uid 99); 11 Apr 2017 16:28:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Apr 2017 16:28:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id B8343C14F1 for ; Tue, 11 Apr 2017 16:28:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.474 X-Spam-Level: *** X-Spam-Status: No, score=3.474 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FORGED_MUA_MOZILLA=1.596, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id RtYBz18Klr2C for ; Tue, 11 Apr 2017 16:28:33 +0000 (UTC) Received: from nm20-vm5.bullet.mail.ne1.yahoo.com (nm20-vm5.bullet.mail.ne1.yahoo.com [98.138.91.242]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 146E260DA2 for ; Tue, 11 Apr 2017 16:28:31 +0000 (UTC) Received: from [98.138.100.114] by nm20.bullet.mail.ne1.yahoo.com with NNFMP; 11 Apr 2017 16:28:25 -0000 Received: from [98.138.226.165] by tm105.bullet.mail.ne1.yahoo.com with NNFMP; 11 Apr 2017 16:28:25 -0000 Received: from [127.0.0.1] by omp1066.mail.ne1.yahoo.com with NNFMP; 11 Apr 2017 16:28:25 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 1329.5369.bm@omp1066.mail.ne1.yahoo.com X-YMail-OSG: zfm0vDMVM1m_fZ8YL6VT5qKseGW8pZ9ea4QjUW4wqtwCNBptbABRQjS6I2i74vM LbGPYjwkmrwkI83bbKKm6u99hYGo8ZDdnYNEgMtpAfEvXq7wtsoi9Eb133ORbzfCBdQagsGQOtAU usUYSm3pq_xCBs1pgjn5N22jiC.uQsoKmuBM2E0P5aDp8tQ4QnzvMiUYKDr8tU3wCMHMsojnS0pL AP7m6o40dO1owOWgy9WfKJXXjZ53waOuU_zEmES3OC30lYzsQ2QDfwtbqjBqDI86eGF6dD4AnPhn KtNAQ6LU7WzN46dlKRL0amZa7DpLhFM2WRNORLWChPWYIClkYI0cRtIpZodS4vFMbZVt0JHUZwmM y6Dp0qcJDVwIZv8tVb9MFxxbncnUdwfMBkKxFjRDYjIxorZVphKRnveqrR56qhY_Yn2KvKNalnq6 JCkGClMnT2TIyKbuPxo_tcoNacgESh8ukcMSpjWuEWCCpZcCyzyUyTvXv4eaOAeUktzPYGBEZbxR 62kv4srJLJDe.SCuz_BSPUg-- Received: from jws200050.mail.ne1.yahoo.com by sendmailws130.mail.ne1.yahoo.com; Tue, 11 Apr 2017 16:28:24 +0000; 1491928104.586 Date: Tue, 11 Apr 2017 16:28:24 +0000 (UTC) From: Ankit Agarwal Reply-To: Ankit Agarwal To: Tomcat Users List Message-ID: <1379118353.728921.1491928104237@mail.yahoo.com> In-Reply-To: <51558a001e564de8877188bd37a005e1@CISEXCASMB02-1a.caci.com> References: <51558a001e564de8877188bd37a005e1@CISEXCASMB02-1a.caci.com> Subject: Re: Using Log4J2 2.8 (via the 1.2 API Bridge) for Tomcat8 Internal Logging - RollingFileAppender does not (cannot?) create new Log File MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_728920_2146674159.1491928104234" X-Mailer: WebService/1.1.9374 YahooMailNeo Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 archived-at: Tue, 11 Apr 2017 16:28:38 -0000 ------=_Part_728920_2146674159.1491928104234 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Cris, 1. No worries. All thoughts and questions are welcome because it helps me t= hink too :) 2. You can replace the java.utils.logging entirely with Log4J in Tomcat. Se= e the link I posted in my very first email. The Tomcat documentation provid= es the steps.The only problem is that Tomcat only supports the Log4J 1.x AP= I. It doesn't natively support Log4J2 so we have to use the 1.x -> 2.x Brid= ge and some things do not work. E.g., I've found that the bridge does not s= upport the "Delete" directive within the "DefaultRolloverStrategy", hence I= have to delete the old zipped Tomcat logs with a script myself - =C2=A0Mor= e likely this is because "Delete" is a Log4J2 construct that Tomcat doesn't= know about yet I'm replacing the internal logging of Tomcat so, e.g., the catalina log fil= es and the localhost log files are written by Log4J instead of the standard= java.util.logging Log4J2 works great within the WARs I deploy. 3. The problem is that, for me when the first log-able event occurs after t= he old log file is zipped, a new log file is not created by the Tomcat Log4= J. Instead nothing is logged and operations just fail. E.g., once the old l= og file has been zipped, if I try to deploy a new WAR, it just fails becaus= e there is no place to log messages (since the new log file was not created= ). Once I restart Tomcat, everything works fine. It seems that the Tomcat Log4= J only rolls over to a new file (i.e., creates it) on startup and not while= its running. Ankit On Tuesday, April 11, 2017 7:41 AM, "Berneburg, Cris J. - US" wrote: =20 Ankit -----Original Message----- From: Ankit Agarwal [mailto:ankit_agarwal@...]=20 Sent: Monday, April 10, 2017 3:24 PM To: users@tomcat.apache.org Subject: Using Log4J2 2.8 (via the 1.2 API Bridge) for Tomcat8 Internal Log= ging - RollingFileAppender does not (cannot?) create new Log File > Hi, > > I=E2=80=99m using Log4J2 (2.8) via the 1.2 API Bridge for Tomcat 8 intern= al logging. > > I followed the instructions here: > https://tomcat.apache.org/tomcat-8.0-doc/logging.html#Using_Log4j > > - With the exception that I also copied the Bridge JAR into the Tomcat8 l= ib directory > > I have configured Log4J2 with this XML file > > > >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ${sys:c= atalina.base}/logs >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CMS >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Tomcat= >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ${en= v:PUBLIC_IP_ADDRESS} >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 %d{DATE} "%d{= ISO8601}" "${systemName}" "${componentName}" "%X{clientIpAddress}" "%X{clie= ntTcpPort}" "%X{username}" "%X{sessionId}" "%X{sessionAuthenticationId}" "%= X{sessionAuthenticationToken}" "${serverIpAddress}" "%T" "%t" "%X{apiName}"= "%X{apiSystemActionType}" "%X{apiSystemItemType}" "%x" "%l" "%p" "%m"%n%n<= /Property> >=C2=A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C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0 > > > All 4 RollingFile Appenders are configured identically (except for > the log filename). > > The problem I=E2=80=99m running into is that when the > SizeBasedTriggeringPolicy is executed, the current log file is > zipped. However, a new log file is not created. > > As a result, the Tomcat8 stops logging. > > If I restart Tomcat8, then a new file is created and the Tomcat8 > functions normally, but only until this new log file reaches its > limit and is zipped up. Then once again, the problem repeats itself. > > Does the 1.2 API Bridge / Tomcat 8 not support the > SizeBasedTriggeringPolicy? > > Do I have any options other than restarting the Tomcat8? Will the > TimeBasedTriggeringPolicy work and is that my only option? > > Since the Log4J2 being used in Tomcat8 has no problem creating the > required files on restart, I don=E2=80=99t think its a permissions issue. > > I=E2=80=99d appreciate any thoughts and pointers. > > Thanks, > Ankit 3 things: 1. Sorry, I cannot answer your questions directly cuz I'm kind of newbie in= this arena. 2. Are you allowed to overwrite what log files that Tomcat would generate a= nyway?=C2=A0 We use Log4J2 to create custom log files and leave the Tomcat-= generated ones alone.=C2=A0 Maybe our configuration is a little wacky.=C2= =A0 :-) 3. In my (very limited) experience, Log4J2 creates a new log file only when= the first log-able event actually happens.=C2=A0 IOW, it won't create an e= mpty log file without actually having something to log. Please let us know what you learn and how you progress in solving the issue= ! -- Cris Berneburg CACI Lead Software Engineer --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org =20 ------=_Part_728920_2146674159.1491928104234--