logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kaustuva mukherjee <kaustuva.mukher...@citigroup.com>
Subject problem getting location info from client
Date Mon, 06 Feb 2006 15:47:17 GMT
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 
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



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

View raw message