0

we've an application, running in JBOSS EAP 6.4, generating a lot of logs. So we decided to give the application its own log, rotating each hour. The application uses SFL4J, which is compatible with JBOSS Logging. As we can't change parameters on JBOSS config we decided to use the logging per deployment feature and added, following the developers manual, a file logging.properties in the classpath, with the File Handler set up as below

handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.FILE.level=ALL
handler.FILE.formatter=PATTERN
handler.FILE.properties=append,autoFlush,enabled,suffix,fileName
handler.FILE.constructorProperties=fileName,append
handler.FILE.append=true
handler.FILE.autoFlush=true
handler.FILE.enabled=true
handler.FILE.suffix=.yyyy-MM-dd-HH
handler.FILE.fileName=${jboss.server.log.dir}\\pfl.log

While in DEV station everything works as expected (JBOSS Developer Studio 7.1.1 with JBOSS EAP 6.1), in production and test JBOSS generates correctly the pfl.log file and the hourly backups, BUT the pfl.log is never made empty. So it's growing indefinitely (and so the hourly files). Also we noted that the same behavior happens using dayly rotating logs

handler.FILE.suffix=.yyyy-MM-dd

This is getting us crazy.. How can we solve this ? Where can be the problem ? Did we make any config mistakes ?

Massimo Petrus
  • 1,881
  • 2
  • 13
  • 26
  • Do you have anything monitoring the log file? Given the `\\` in the file name I'm assuming Windows which is rather notorious for failing to close files if another process has it open. – James R. Perkins Oct 13 '17 at 20:00
  • We monitor the log files manually. The main log is growing day by day, generating daily backups, but not resetting. The environment is Windows. It seems that (maybe) it happens because we did not restart the whole server but only the webapp. If this was the reason I believe this behavior is problematic. The simple restart of the app makes the per deployment logging parameters taken into account (the rotation frequency) but creates an odd behavior (not resetting the main log), while before introducing the logging per deployment the log was rotating correctly, resetting the main file etc. – Massimo Petrus Oct 15 '17 at 09:43
  • Tomorrow we'll make the restart of the whole server and we'll see if everything fixes. This is a unconfortable operation because we've to open a ticket and wait for the (external) hosting support to operate. In case of new apps deployments it needs a coordination with the external staff and is operatively difficult. – Massimo Petrus Oct 15 '17 at 09:46
  • A restart should definitely not be required. The only reason I can think of the file not being truncated is something at the OS level. – James R. Perkins Oct 15 '17 at 22:22
  • Sorry I was mentioning a Restart of the AppServer, not of the whole server. Also in my mind there's a thinking about something at OS level, but we have no evidence of any errors – Massimo Petrus Oct 16 '17 at 07:43
  • Since it's JBoss EAP 6 it uses the `java.io.File.renameTo()` which won't really report failures. So if the rotation fails and it opens reopens the file with append=true then it would append log messages rather than create a new file. – James R. Perkins Oct 16 '17 at 17:21
  • At the end the Operations team did the restart of the Application Server and it worked perfectly. Now logs are rotated correctly. Now we know how to do it...I don't know if it is a problem at OS level or not (but I don't think). – Massimo Petrus Oct 31 '17 at 19:38

0 Answers0