How to create server.log file every time when i restart jboss server. Default it create only once when i start jboss server first time. i want to create separate server.log file every time when i restart jboss server old server.log file should be rename.
In the jboss-log4j.xml, there's a appender configuration named "FILE" for server.log. There's an "Append" attribute which you can set to false. This will result in the server.log file being created afresh whenever the server is restarted. However, it wont create a backup copy of the old file.
You could also change the FILE appender to use RollingFileAppender class. This appender limits the log file to a certain size, at which point it closes and renames the log file, and opens a new log file.
when adding appender and we omit MaxFileSize what will be the default size?
There is no limit to the file size. It will keep increasing. However, if you are having a DailyRollingFileAppender, then the file will be rolled over every day at midnight, irrespective of the log file size.
According to the Log4J book I have (from 2005), the default file size for the rolling appender is 10MB. (I could have looked in the source code to see if that is still the default size, but you can do that as easily as I can.)
Personally, I never leave off such a property value. First, the default is usually not acceptable (10MB is a little small). Second, everyone who later on looks at the config file will ask the same question you did, including you because a year from now even you will not remember what it was.