You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by kaustuva mukherjee <ka...@citigroup.com> on 2006/02/06 16:47:17 UTC

problem getting location info from client

I have subclassed the Logger class of log4j. The problem i have is that how to 
get the location information when i use the subclass of the Logger class i.e 
XXXLogger. 
e.g I have the following client code where i am logging using XXXLogger

public class SomeClient{

XXXLogger logger = (XXXLogger) XXXLogger.getLogger(some.transaction);

public someClientMethod(){

logger.info( param1, message, param3 [] );

}

public class XXXLogger extends Logger {

public void info(int param1, String Msg,  Object[] params) {

//do something here

this.info(message);

}

public class XXXLayout extends Layout 

public String format(LoggingEvent event) {

   this.event = event;
   return convertToText();  
   
   }

  private String convertToText() {
LocationInfo locInfo= event.getLocationInformation();
    String lineNumber =locInfo.getLineNumber(); 
    String methodName =locInfo.getMethodName();
    String className = locInfo.getClassName();
    String message = (String) event.getMessage();
:
:  
In the output of my custom layout i am getting the method name and className of 
XXXLogger but i want to get the location info of the SomeClient !! 
Do you know how this could be resolved?



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org