Maximum File Size - supported in log4j FileAppender

∥☆過路亽.° 提交于 2019-11-30 18:06:36

By default, maximum file size is 10MB(If you don't mention explicitly). And if you define explicitly, you can define any value upto GB(even 1000GB). But think, when you open this file, your machine must have an equal amount of RAM. So you have to take this into consideration before choosing file size. An example here

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=logging.log
log4j.appender.file.MaxFileSize=100GB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

FileAppender doesn't contain any field for setting file size. But its subclasses RollingFileAppender and DailyFileAppender contains.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!