Hi, I have a class that holds a reference to Log4j's logger in it.I call this LoggerWrapper.
The intention of using this and not Logger(log4j's Logger) directly is to keep my code as independent of log4j as possible. This LoggerWrapper has methods called logDebug(Object description) i.e logXXX(Object description) for all 5 levels of logging. The implementation is very straight forward,like this logDebug(Object desc) { logger.debug(desc); //logger is an instance of LoggerWrapper and of type org.apache.log4j.Logger } Now the problem..... In all my source code where there is a need to log i do it in this fashion LoggerWrapper.logDebug(Object tobeLogged) In doing so the log files that are generated always have the first line as line #13,line #18 etc that refer to where logger.xxx() methods are being used in LoggerWrapper's logXXX methods. This line number is of no help to me at all since it always gives me the LoggerWrapper's line number. What I actually need is that it should reflect the lines of the actual java file where i called LoggerWrapper.logDebug(Object tobeLogged) I have just pasted one such line from my log file here ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2006 08 01 16:33:14:072 BST DEBUG - com.jpmorgan.pathclear.siml.common.log.LoggerWrapper.logDebug(LoggerWrapper.java:66) -Setting ibatis template ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Can you kindly tell me what I should do so that the line number that i get is the line from where i issued this debug statement and not the line number from my wrapper class. I am now not even sure that my approach was right although the intention behind was to be not too reliant on any particular implementation of logging. Look foward to solutions to tackle this problem.If there is a fundamental flaw in the way this has been designed look forward to some help in getting this sorted out. I could adopt Commons logging on top of log4j.That is one option.But is there a way to mend this itself so I get logs which are more informative(reflect the actual line nos) ? Regards, Chetan ----------------------------------------- This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.