Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 9187 invoked from network); 12 May 2006 16:43:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 May 2006 16:43:51 -0000 Received: (qmail 34302 invoked by uid 500); 12 May 2006 16:43:47 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 34277 invoked by uid 500); 12 May 2006 16:43:47 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 34266 invoked by uid 99); 12 May 2006 16:43:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 May 2006 09:43:47 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [68.142.198.212] (HELO smtp113.sbc.mail.mud.yahoo.com) (68.142.198.212) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 12 May 2006 09:43:45 -0700 Received: (qmail 99068 invoked from network); 12 May 2006 16:43:24 -0000 Received: from unknown (HELO ?192.168.10.100?) (curt.arnold@sbcglobal.net@72.181.12.112 with plain) by smtp113.sbc.mail.mud.yahoo.com with SMTP; 12 May 2006 16:43:23 -0000 Mime-Version: 1.0 (Apple Message framework v749.3) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <4CD0F9AF-DFEC-449D-B524-E4B7AA719137@apache.org> Content-Transfer-Encoding: 7bit From: Curt Arnold Subject: Re: how to print line number Date: Fri, 12 May 2006 11:43:22 -0500 To: Log4J Users List X-Mailer: Apple Mail (2.749.3) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On May 12, 2006, at 1:53 AM, Shiby Maria John wrote: > Hi, > > I have a framework that implements the logging by log4j. > Now my classes need to log using this and I need to print the line > number from where the log originally originated from. > ... > 11 : public void debug(String message) { > 12 : cat.debug(message); > 13 : } > > > Is there any way to acheive this?? > > Thanks in advance, > Shiby > Make the body of the methods something like: public class Logger { private static final className = Logger.class.getName(); ... public void debug(String message) { if (cat.isDebugEnabled()) { cat.forcedLog(className, Level.DEBUG, message); } } --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org