Hi Apurva, We are having a class level variable as you mentioned as below
org.apache.log4j.Category cat = org.apache.log4j.Category.getInstance(ResResourceManager.class.getName() ); I think the difference will be in the log4j.appender.R.layout.ConversionPattern=%d, [%t], %-5p, %c, - %m%n in log4jconfig.properties file. Could you please let me know log4j.appender.R.layout.ConversionPattern value ..?? Thanks, Viral -----Original Message----- From: Apurva Goswami [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 11:50 AM To: 'Struts Users Mailing List' Subject: RE: logging Try Put these lines on top of your class file // Log4j // Log4j with Try-Catch: try {...} catch (Exception e) { cat.error(e, e); } static org.apache.log4j.Category cat = org.apache.log4j.Category.getInstance("File Name".class.getName()); E.g. static org.apache.log4j.Category cat = org.apache.log4j.Category.getInstance(ResResourceManager.class.getName() ); Use these methods as per your requirement cat.debug() - > cat.debug("", e); cat.error() - > cat.error("", e); cat.fatal() - > cat.fatal("", e); It prints the method name in the log and you do not need to pass. E.g. if I use statement : if (cat.isDebugEnabled()) cat.debug("Retrieved " + agencyDepPortsDropDownList.count() + " " + countrycode + " Ports"); I get this in my log file : (CoreFareMainL:3515 initAgencyDepPortsDropDownList) - Retrieved 117 AU Ports (Class file: linenumber method ) - string message Hope it helps Cheers Apurva -----Original Message----- From: Viral_Thakkar [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 4:03 PM To: Struts Users Mailing List Subject: logging Hi All, I am using commons-logging (using log4j) for logging.. We do following logging style... if (logger.isDebugEnabled()) { logger.debug("Method Name : + some Message"); } Here can we get the method name using java reflection or some other way so that no need to pass the method name while logging the message ..??? Regards, Viral --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]