为了能在Glassfish的4.1,我们的系统日志必须改变下域中的logging.properties(例如的glassfish /域/域1 /配置)
线
handlerServices=com.sun.enterprise.server.logging.GFFileHandler
应该改变
handlerServices=com.sun.enterprise.server.logging.GFFileHandler,com.sun.enterprise.server.logging.SyslogHandler
见:[GLASSFISH-20718] Write to System Log option do not send log on localhost udp port 514
为了使一个更清洁的方式这一变化,而不是改变logging.properties直接就可以使用asadmin如下:
bash-4.3# asadmin set-log-attributes handlers=java.util.logging.ConsoleHandler,com.sun.enterprise.server.logging.SyslogHandler
handlers logging attribute value set to java.util.logging.ConsoleHandler,com.sun.enterprise.server.logging.SyslogHandler.
The logging attributes are saved successfully for server.
最后,为了使系统日志,你可以调用的asadmin如下:
bash-4.3# asadmin set-log-attributes com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging=true
com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging logging attribute value set to true.
The logging attributes are saved successfully for server.