How you can control the size of a log file?
We normally append in the log file and its obviously neccessary but after a particular file size is achived i want all the previous log to be deleted and开发者_运维知识库 new log should create. How this is possible?
Apart from using log4j. I am more interested if we could have any way from FileHandler
.
Log4J has a RollingFileAppender
. Java logging has FileHandler
, which offers similar functionality. Other logging frameworks might have the same functionality. Check the documentation for your logging framework to know if it exists or not.
If you use log4j there are options that provide all of this functionality.
use log4j and maxFileSize
Please check below link , check fileappenders section for log4j, there it given clearly.
File Appenders
精彩评论