The recommended means for general viewing of logging information is to use the Log Viewer in the Administration Console. The Log Viewer simplifies reading, searching, and filtering log file contents. For instructions, see the Administration Console online help.
Oracle GlassFish Server also allows you to collect log files into a ZIP archive, which provides the means to obtain and view log files for an instance or cluster even when it is not currently running. The following section explains how to collect all available log files for an instance or cluster and compile them into a single ZIP archive, which is done by using the collect-log-files subcommand.
Use the collect-log-files subcommand in remote mode to collect log files into a ZIP archive. The default target of this subcommand is the DAS. Optionally you can target a configuration, server, instance, or cluster.
Remote subcommands require a running server.
The default location in which the ZIP archive is created is the domain-dir/collected-logs directory. The collect-log-files subcommand allows you to specify a nondefault directory in which the ZIP archive is to be created by using the --retrieve option set to true, followed by the directory name.
The name of the ZIP file contains the timestamp, as follows:
Example 7-13 Creating a ZIP Archive
This example shows collecting the log files for the cluster MyCluster and compiling them into a ZIP archive in the /space/output directory.
asadmin> collect-log-files --target MyCluster --retrieve true /space/output Log files are downloaded for ClusterServer1. Log files are downloaded for ClusterServer2. Created Zip file under /space/output/log_2011-02-10_13-35-25.zip. Command collect-log-files executed successfully.
When the ZIP file created by the preceding command is uncompressed, the following directory structure is created:
as-install-parent/ glassfish/ domains/ domain-name/ collected_logs/ logs/ ClusterServer1/ server.log ClusterServer2/ server.log
You can view the full syntax and options of the subcommand by typing asadmin help collect-log-files at the command line.