How to create a log file in the folder which will be created at run time
- by swati
Hello Everyone,
I new to apache logger.I am using apache log4j for my application.
I am using the following configuration file
configure the root logger
log4j.rootLogger=INFO, STDOUT, DAILY
configure the console appender
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.Target=System.out
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%p] %c:%L - %m%n
configure the daily rolling file appender
log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DAILY.File=log4jtest.log
log4j.appender.DAILY.DatePattern='.'yyyy-MM-dd-HH-mm
log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout
log4j.appender.DAILY.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%p] %c:%L - %m%n
So when my application runs it creates a folder called somename_2010-04-09-23-09 .
My log file has to be created inside of this somename_2010-04-09-23-09 folder.(Which created at run time..).
Is there anyway to do that..
Is there anyway we can specify in the configuration file so that it will create at run time the log file inside of the folder somename_2010-04-09-23-03 folder..?
I would really appreciate if some one can answer to my questions.
Thanks,
Swati