Latest functionality in GlassFish v3 logging.
This blog highlights some of the changes that are part of GlassFish v3 logging. Since Prelude I have added 3 asadmin commands related to logging. I have updated the set-log-level command and changed the syntax. See below for details. The new commands are:
* asadmin rotate-log
* asadmin list-logger-levels
* asadmin set-log-level logger-name=level:logger-name=level
The first command rotates the log files immediately. Users can now use native scheduling software such as cron to rotate the logs. We still support rotating logs based on file size or elapsed time since the last log rotation and this new command allows more flexibility when rotating log files. The second command lists the loggers and their current level. This command reports on all the known loggers that are listed in logging.properties file. Note that in some cases the loggers may not have been created by the respective containers however they will still appear in the list. The third command, asadmin set-log-level, sets the level for aone or more loggers. For example, to set the log level of the web container logger level to WARNING simply type: asadmin set-log-level javax.enterprise.system.container.web=WARNING. This command updates the logging.properties file which means that the values are persisted across server restart. Use asadmin list-logger-levels to get the names of the loggers.
Finally, I've added a property to logging.properties file in the domain config directory that controls the number of message written to the server log file. GlassFish v3 logging code writes messages to a queue instead of directly to the server log file. Log messages are taken off the queue and written to the server log file as cycles become available. The property name is com.sun.enterprise.server.logging.GFFileHandler.flushFrequency. This propertys controls the number of messages that are taken off the queue and written to a file a time. The actual number written is the value of this property or less depending on the number of messages in the queue. The default value is 1.