By default WildFly uses a periodic log handler and will create a log for every calendar day. This is different than WebSphere or Jboss, and may not be the desired format for many customers. Luckily WildFly has highly customizable logging.
- Open the WildFly Admin Console (http://<host>:9990/console by default).
- Navigate to the Logging menu at Configuration>Subsystems>Logging>View
- Click over to the HANDLER tab at the top of the Logging page. Here you can choose to make a log handler based on many criteria. This example will use a Size Handler, which is similar to the way WebSphere or Jboss handles logging.
- Click the Add button and give your Handler a value for name, Path, and relative to. Path can be used to customize the actual name of the log files, and relative path should be "jboss.server.log.dir". For this example we used the following:
Name: Size
Path: server.log
relative to: jboss.server.log.dir - Save the handler and edit the attributes to suit your needs before saving those as well. Some common attributes you may want to change are the following:
Max backup index: 1 - This controls how many log files are created before rolling off. It is recommended to set this to something greater than the default of 1.
Rotate size: 2m - This controls the size of each log file before it rolls over to the next. You can leave this at 2m, or customize it to fit your needs. - Once your new log handler is customized to your liking we will need to enable it in the ROOT LOGGER tab. Click edit and replace the FILE handler in the Handlers: attribute with the new handler and save.
After saving these changes to the root logger this change will go into effect immediately.
Comments
0 comments
Please sign in to leave a comment.