Wednesday, April 25, 2012

log4j.properties

Following is a sample log4j.properties, which output all logs to console and writes INFO+ level log to a file
#default log level is set to 'debug' it will output all log to console 
log4j.rootLogger=debug,stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %5p %c{1}:%L - %m%n

#log level that is >=INFO, will use defaultLog definition for packagename
log4j.category.packagename=INFO, defaultLog

#define the log file directory
log.dir=/some/directory/logname.log

datestamp=yyyy-MM-dd/HH:mm:ss.SSS/zzz
roll.pattern.daily=.yyyy-MM-dd

#defines defaultLog, log file is rotated daily
log4j.appender.defaultLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.defaultLog.DatePattern=${roll.pattern.daily}
log4j.appender.defaultLog.File=${log.dir}
log4j.appender.defaultLog.layout=org.apache.log4j.PatternLayout
log4j.appender.defaultLog.layout.ConversionPattern=%d{${datestamp}} [%t] %-5p %m%n

4 comments:

  1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai


    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the

    authors explore the idea of using Java in Big Data platforms.

    Spring Training in Chennai


    The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai

    ReplyDelete
  2. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai


    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the

    authors explore the idea of using Java in Big Data platforms.

    Spring Training in Chennai


    The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai

    ReplyDelete