Vijay K Anand wrote:
Hi
Here  goes my log4j property file

log4j.rootLogger=ERROR, A2
log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.Threshold=DEBUG
log4j.appender.A2.file=npi_log
log4j.appender.A2.append=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

here is the code where i want to log

static Logger logger = Logger.getLogger(HighLevelAction.class.getClass());

logger.debug("test");

th eproblem is : it is not logging anything

Two things:

As someone else pointed out, you've set the logging level to ERROR but you're logging using debug, so the log message isn't going to show up. Either change the root logging level to DEBUG, or add lines like the following to your config:

  log4j.logger.package-name=DEBUG

where 'package-name' is the package (or fully qualified class) name for which you want debug logging.

Second, where you construct the logger instance, you have ...class.getClass(). You don't want the getClass() call. I.e. your code should read

  static Logger logger = Logger.getLogger(HighLevelAction.class);

L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/~laurie/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to