I am trying to log some user data to log file whenever a request arrive with log4j
in Play! Framework 1.2.5. I need to have 2 separated log file which will be used by different methods and classes. I would like to have my customized log files formatted as :
date with time - request running time and some string
First question : Could you please show me a helpful tutorial or an answer? Because whatever I have done so far was useless.
The second question : How can I configure log4j to log for each level such as only log ERROR
message on one file, while only print INFO
and WARN
message on other file. My log4j.properties
file is below. I know the previleges of message. But even I defined threshold why ERROR
, FATAL
or WARN
messages also are written to info file?
log4j.rootLogger = ERROR, JUSTINFO, JUSTERROR
log4j.logger = INFO
log4j.appender.JUSTINFO = org.apache.log4j.RollingFileAppender
log4j.appender.JUSTINFO.layout = org.apache.log4j.PatternLayout
log4j.appender.JUSTINFO.layout.ConversionPattern = %d{dd/MM/yyyy HH:mm:ss} - [%X{processTime}] - %m%n
log4j.appender.JUSTINFO.File = log/info.log
log4j.appender.JUSTINFO.Threshold = INFO
log4j.appender.JUSTERROR = org.apache.log4j.RollingFileAppender
log4j.appender.JUSTERROR.layout = org.apache.log4j.PatternLayout
log4j.appender.JUSTERROR.layout.ConversionPattern = %d{dd/MM/yyyy HH:mm:ss} - [%X{processTime}] - %m%n
log4j.appender.JUSTERROR.File =log/warn.log
log4j.appender.JUSTERROR.Threshold = ERROR