Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 94088 invoked from network); 23 May 2005 18:57:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 May 2005 18:57:32 -0000 Received: (qmail 24776 invoked by uid 500); 23 May 2005 18:57:12 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 24754 invoked by uid 500); 23 May 2005 18:57:11 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 24739 invoked by uid 99); 23 May 2005 18:57:11 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtpauth05.mail.atl.earthlink.net (HELO smtpauth05.mail.atl.earthlink.net) (209.86.89.65) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 23 May 2005 11:57:10 -0700 Received: from [66.47.111.183] (helo=joeandlane.com) by smtpauth05.mail.atl.earthlink.net with asmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1DaI6r-0004eM-R0 for tomcat-user@jakarta.apache.org; Mon, 23 May 2005 14:57:06 -0400 Received: from joeandlane.com (localhost [127.0.0.1]) by joeandlane.com (8.13.1/8.13.1) with ESMTP id j4NJ3X2j037031 for ; Mon, 23 May 2005 14:03:33 -0500 (CDT) (envelope-from lane@joeandlane.com) Received: from localhost (localhost [[UNIX: localhost]]) by joeandlane.com (8.13.1/8.13.1/Submit) id j4NJ3WFA037030 for tomcat-user@jakarta.apache.org; Mon, 23 May 2005 14:03:32 -0500 (CDT) (envelope-from lane@joeandlane.com) From: Lane To: "Tomcat Users List" Subject: Re: confused about simple logging Date: Mon, 23 May 2005 14:03:32 -0500 User-Agent: KMail/1.8 References: <001401c55fbc$cc2cb6e0$0201a8c0@sjkdesktop> In-Reply-To: <001401c55fbc$cc2cb6e0$0201a8c0@sjkdesktop> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200505231403.32544.lane@joeandlane.com> X-ELNK-Trace: e56a4b6ca9bdfda11aa676d7e74259b7b3291a7d08dfec790eef14cefc5977f2f4939888bc9542b9350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 66.47.111.183 X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Monday 23 May 2005 12:28, Steve Kirk wrote: > Your confusion possibly arises because there are at least 2 types of logger > that you might mean, and 3 main choices for one of those at the moment, > although one of those 3 is deprecated and a second is probably becoming > less popular. > > OK I'll take a quick stab and see if this gets you anywhere in the right > direction. > > You mention two distinct types of logging. The 1st is the "hit" logging > which is very similar to what you would get from apache httpd. This simply > logs each incoming request. This is achieved by adding a to your > %catalina_home%\conf\server.xml - you can embed it inside the > , or tags, but for your > purposes, just shove it in the engine for now. It looks a bit like this: > > > className="org.apache.catalina.valves.FastCommonAccessLogValve" > directory="logs" prefix="ao_access_log_" suffix=".log" > pattern="common" resolveHosts="false"/> > > > You can tweak the path, filename, and the pattern that defines each line - > see > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html > for details. Leave resolveHosts set "false" to speed up performance. > > Not that my example above is from my own 5.5.9 server - ISTR 5.0 config > syntax is different - check the doc link above for the detail. > > The 2nd part of your logging is where you write your own messages to a > logfile. I did that as follows: > > java.util.logging.Logger logger = > java.util.logging.Logger.getLogger("logname"); > logger.setLevel(logLevel); > fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true); > fh.setFormatter(new AoLogFormatter(logFileDateTimePattern)); > logger.addHandler(fh); > > Then to write a log message you can just do this: > > log("Write this to the log"); > > and it will write the log file to logFilePath > > See the java.util.logging.Logger javadocs for more details. > > This is very basic. Much more spophistication can be achieved through > config files. > > > -----Original Message----- > > From: Lane [mailto:lane@joeandlane.com] > > Sent: Monday 23 May 2005 18:01 > > To: Tomcat Users List > > Subject: confused about simple logging > > > > > > Hello. > > > > I'm a bit confused about simple logging on tomcat 5.0. �I've > > read much of the > > FAQ at > > http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that > > doesn't seem to address what I'm looking for, which is just > > routine mundane > > daily activity. > > > > For instance, if I create and deploy a simple "Hello World" > > application that > > contains only index.jsp, no servlets, no external classes and no JNDI > > resources, where on earth will a "hit" be recorded when I navigate to > > http://localhost/helloworld/index.jsp ? And where is the > > error recorded if I > > mistype and navigate to http://localhost/helloworld/jndex.JSP ? > > > > Do I have to build such logging into the application? �Or > > does Catalina handle > > that for me? �And if so ... where on earth? > > > > I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0 > > > > I see log information in /usr/local/jakarta-tomcat5.0/logs/stderr.log > > and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing > > that records a > > "page hit." > > > > Thanks, > > > > lane > > Thanks, Steven. I got the configured and working in server.xml and immediately set about trying to make it work only in a specific context. I guess I just can't leave well enough alone :) You are correct that for my purposes it is alright to log such requests "system" (engine || server) wide. But the documentation at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html#Special+Features seems to imply such an access log can be maintained per-context. I've tried to configure it in $CATALINA_HOME/conf/Catalina/localhost/helloworld.xml and in $CATALINA_HOME/webapps/hellowworld/WEB-INF/web.xml but the seems to be ignored unless it is in $CATALINA_HOME/conf/server.xml I'm set now, but if anybody has information on per-context access logging it'd sure help me troubleshoot. lane --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org