How to rotate the stdout file daily or periodically in JBoss windows service

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x

Issue

  • Is there a way to rotate the stdout file generated by JBoss windows service?
  • How can I disable jbosseap7-stdout.yyyy-MM-dd.log and jbosseap7-stderr.yyyy-MM-dd.log in JBoss Windows service?

Resolution

  • Apache commons daemon process runner is available for JBoss EAP 6/7 on Windows. There is no mechanism available to rotate the standard output/error logs. There is a jira opened regarding the issue.

There are two workarounds:

  • It is recommended to review the logging configuration to ensure that the standard output log does not become too large. Configure JBoss logging so that less logging data is sent to the CONSOLE appended.
  • Before registering JBoss EAP 7 windows service by service.bat, log output for jbosseap7-stdout.yyyy-MM-dd.log and jbosseap7-stderr.yyyy-MM-dd.log can be disabled by removing --StdOutput=%STDOUT% --StdError=%STDERR% options from service.bat in line the line beginning with %PRUNSRV%:
%PRUNSRV% install %SHORTNAME% %RUNAS% --DisplayName=%DISPLAYNAME% --Description="%DESCRIPTION%" --LogLevel=%LOGLEVEL% --LogPath=%LOGPATH% --LogPrefix=service --StartMode=exe --Startup=%STARTUP_MODE% --StartImage=cmd.exe --StartPath=%START_PATH% ++StartParams=%STARTPARAM% --StopMode=exe --StopImage=cmd.exe --StopPath=%STOP_PATH%  ++StopParams=%STOPPARAM%

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments