Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE30F9685 for ; Wed, 20 Jun 2012 22:23:28 +0000 (UTC) Received: (qmail 63392 invoked by uid 500); 20 Jun 2012 22:23:24 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 63235 invoked by uid 500); 20 Jun 2012 22:23:22 -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 63217 invoked by uid 99); 20 Jun 2012 22:23:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 22:23:21 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.62.96] (HELO qmta09.westchester.pa.mail.comcast.net) (76.96.62.96) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 22:23:15 +0000 Received: from omta23.westchester.pa.mail.comcast.net ([76.96.62.74]) by qmta09.westchester.pa.mail.comcast.net with comcast id QajX1j0061c6gX859mNvUx; Wed, 20 Jun 2012 22:22:55 +0000 Received: from Christophers-MacBook-Pro.local ([69.143.109.145]) by omta23.westchester.pa.mail.comcast.net with comcast id QmNq1j01G38FjT13jmNse6; Wed, 20 Jun 2012 22:22:53 +0000 Message-ID: <4FE24D39.3090207@christopherschultz.net> Date: Wed, 20 Jun 2012 18:22:49 -0400 From: Christopher Schultz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Creating separate log for each request References: <99C8B2929B39C24493377AC7A121E21FB02DA44D9D@USEA-EXCH8.na.uis.unisys.com> In-Reply-To: X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Lahiru, On 6/20/12 5:39 PM, Lahiru Gunathilake wrote: > Hi Caldarale, > > Its not a website.. I am hosting a middleware which will be used > by scientist to run their application in the Grid. So Ideal > scenario is like 2--30 requests per day but they are long running > and very time consuming (Some jobs would take 2,3 days or one week > to finish), so the logs are very important. If you need requests to take 2-3 days, then HTTP is not the protocol for you. Are you accepting batch requests via HTTP and then working on them after the request/response has completed? That would make more sense. In any case, most logging frameworks create "Log" (or Logger) objects that live for a long time: they aren't set up to create a Log/Logger, use it for a bit and then discard it, since loggers tend to get used for the life of the JVM. I think what you want is a simple FileWriter. You can even use the existing logging framework's log-level-checks if you want, like this: PrintWriter out = null; try { if(logger.isDebugEnabled()) = new PrintWriter(FileWriter("/logs/job-" + jobId)); ... if(null != out) out.println("Got an interesting value: " + interestingValue); ... } finally { if(null != out) try { out.close(); } catch (IOException ioe) { logger.error("Couldn't close job log", ioe); } } - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/iTTkACgkQ9CaO5/Lv0PDW2gCfRuyYHaUZ8hNbmeKSw/wBmdsD XuIAnRG0NjBmPrsNT8RCDFuvZIbzYIGH =k33J -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org