logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: how to print line number
Date Fri, 12 May 2006 16:43:22 GMT

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


Mime
View raw message