By default JBoss keeps the file locked, since it is writing log messages into it. It is locked as long as JBoss is running and I don't know of other way to release it than stopping JBoss itself.
To keep its size under control, you can modify your log configuration, which is by default in <server>/conf˛jboss-log4j.xml
. You can specify the maximum size of a log file, and define what to do when that size is reached: roll over to a new file, truncate the existing one and start writing over it again, etc.
A basic example (not tested, so no guarantee that it works straight as it is):
<appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
...
<param name="maxFileSize" value="100MB" />
...
</appender>
Moreover, with the maxBackupIndex
parameter you may define the number of backup files (default is 1).