Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 42038 invoked from network); 15 Dec 2004 00:45:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 15 Dec 2004 00:45:50 -0000 Received: (qmail 98673 invoked by uid 500); 15 Dec 2004 00:45:43 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 98599 invoked by uid 500); 15 Dec 2004 00:45:42 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 98544 invoked by uid 99); 15 Dec 2004 00:45:41 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: 204.127.198.35 is neither permitted nor denied by domain of hoju@visi.com) Received: from rwcrmhc11.comcast.net (HELO rwcrmhc11.comcast.net) (204.127.198.35) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 14 Dec 2004 16:45:36 -0800 Received: from nicki.visi.com (c-66-41-141-26.mn.client2.attbi.com[66.41.141.26]) by comcast.net (rwcrmhc11) with SMTP id <2004121500453301300jsar3e>; Wed, 15 Dec 2004 00:45:33 +0000 Message-Id: <5.2.1.1.0.20041214183855.03abbe00@pop.shell.visi.com> X-Sender: hoju@pop.shell.visi.com X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Tue, 14 Dec 2004 18:45:31 -0600 To: "Log4J Users List" From: Jacob Kjome Subject: RE: Log File by java package and jsp package not working In-Reply-To: <616816C3DDC4D74EB11AC96F6D469C1438FDE4@MSPM1BMSGM16.ent.co re.medtronic.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N At 04:15 PM 12/14/2004 -0600, you wrote: >yes, but we are stuck with the folder structure we have, cannot change it. > >Though we will be using BEA for awhile, no plans on changing it...so if we >can stick with a particular webserver, could we then (somehow) make the >logger able to determine servlet to log for? > I think you are reading my reply way too specifically. What I tried to tell you was that your logger naming can be that of your choosing. My example used a naming scheme that was intuitive and easy to remember. If your folder structure doesn't lend itself to this type of naming, then using another naming scheme of your choice. It can be anything you want. What I am trying to stress is that counting on the value returned by this.getClass().getName() for a JSP is not a good idea because it is not intuitive and is not consistent across servers. Even if you figure that you'll never move servers, you never know if the naming scheme will change in the next server version. There is no guarantee. As far as getting no logging currently, you might want to do a System.out.println() of this.getClass().getName() just to see what it is naming the class. If you know that, then you should be able to configure properly if you've named your loggers in this fashion. Jake > > > > >-----Original Message----- >From: Jacob Kjome [mailto:hoju@visi.com] >Sent: Tuesday, December 14, 2004 4:02 PM >To: Log4J Users List >Subject: RE: Log File by java package and jsp package not working > > > >Your loggers need not be named for their class. In fact, for JSP's you can't >count on any particular naming scheme for the generated class. I'm pretty sure >that is entirely implementation specific, so the class name generated for >"hello.jsp" maybe jsp_servlet_hello.java on Tomcat and hello_jsp_servlet.java >on Weblogic (I made these names up, but you get the point). If you start >counting on one naming scheme, you will quickly find yourself tied to a server >implementation. > >I suggest coming up with a standard naming scheme for your JSP's. For >instance, >have them all be within some common base fake package and, maybe have folder >names further distinguish the package. Then, have the final name of the logger >itself be the name of the file (less ".jsp"). For instance, with the base >package "com.mycompany.jsp" and the following files... > >hello.jsp >admin/manage.jsp >admin/another.jsp >help/howto.jsp > >The loggers might be, respectively, named... > >com.mycompany.jsp.Hello >com.mycompany.jsp.admin.Manage >com.mycompany.jsp.admin.Another >com.mycompany.jsp.help.HowTo > >You'd do this by passing in these names rather than >this.getClass().getName() to >the getLogger() method such as.... > >Logger logger = Logger.getLogger("com.mycompany.jsp.admin.Manage"); > >Your config, in order to display logger output for the "admin" package only, >would be... > > > > > > > >Make sense? > >Jake > > >Quoting "Hanson, Bryan" : >> >> >> I'm using log4J in a JSP with taglibs-log. I'm trying to configure the >> log4j.xml such that it will put the JSP log message in a particular log file >> based on the JSP/servlet package. So far, I have not been successful. >> >> Does anyone have ideas how to configure a log4j.xml to log JSP messages to >> package based log files? >> >> >> >> >> >> >> >> We have "capa" directory with JSP pages in it. The webserver compiles the >> jsp to jsp_servlet\_capa with the class package: package jsp_servlet._capa >> >> >> >> >> >> > > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >For additional commands, e-mail: log4j-user-help@logging.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >For additional commands, e-mail: log4j-user-help@logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org