Turn off Glassfish Log Rotation

2019-05-31 01:17发布

问题:

I know that it is possible to configure log rotation options based on file size. I could not find and option to turn off the rotation rules completely at Glassfish 3.1?

Is it possible to disable log rotation at Glassfish 3.1?

回答1:

You can turn off log rotation by setting the File Rotation Limit (server-config -> Logger Settings) to 0 bytes in the glassfish admin gui or via asadmin command:

asadmin set-log-attributes --target server
com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes=0


回答2:

When I try to set a 0 bytes limit in the admin GUI (GF 4.1), I get this error:

Invalid logging attribute name or value com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes=0.

This seems to be consistent with this thread, which also suggests to modify the value directly in logging.properties instead. Doing that worked for me and disabled log rotation.