Newsletter |
How To Create Log4j.properties File
In previous program, i have used FileAppender. But if i would like to change my appender to JDBCAppender, i have to open my java file and do the modifications and need to recompile. We can avoid this by writing one .properties file.
By default the file name would be log4j.properties. This properties file stores data in the form of key, values pairs, in this file keys are fixed but values are our own. We can include all the log4j related properties into this file.
log4j.properties
log4j.rootLogger=DEBUG,CONSOLE,LOGFILE
log4j.appender.CONSOLE=
log4j.appender.CONSOLE.layout=
log4j.appender.CONSOLE.layout.ConversionPattern=log4j.appender.LOGFILE=
log4j.appender.LOGFILE.File=
log4j.appender.LOGFILE.MaxFileSize=
log4j.appender.LOGFILE.layout=
log4j.appender.LOGFILE.layout.ConversionPattern=
will see one example.
You Might Also Like
::. About the Author .:: | ||
neat and clear explanations…thank u so much..best tutorials for beginners
clear cut explanation
log4j.rootLogger=DEBUG,CONSOLE,LOGFILE
These name are predefined or user defined ?
Details about layout.ConversionPattern foramts ?
very very clear data for every thing … nice for beginners and experience also.
Hi..This is very helpful website..
Can You please describe about Web Server And Application Server,as well about TomcatEE server
hi , properties file xml lo cheyala or any other is there