Log and Collect (in GlassFish 3.1)

Real log

Naman had two blog entries which haven't been yet highlighted here. The first one is from December and covers "Configuring Log4J for use in GlassFish 3.1" (the tricky part is where log4j.properties should live). This is a very popular request, so add it to your bookmarks.

Whether you use log4j, java.util.logging or sl4j, you can use the GlassFish Log Viewer accessible from the Web Console, but starting with 3.1, Naman shows how you'll be able to use asadmin collect-log-files.

This new CLI command is fairly straightforward with the ability to select an instance, a full cluster and provide an output file name :
    asadmin collect-log-files [--help] [--target target] --outputfilepath pathname
This returns ZIPped log archives named target_yyyy-mm-dd_hh-min-sec.zip (one file for an entire cluster).


Here's a tip for Mac users: you can easily and quickly view logs using the Mac Console.app. The default file type association for \*.log files on Mac is Console.app, so you can do this from the command:

% open path/to/your.log

If \*.log has been associated with some other app, then you'll have to fix that by looking at the file info for \*.log in Finder and re-associate it back to Console.app.

Posted by Ryan Shoemaker on January 24, 2011 at 03:15 AM PST #

Post a Comment:
Comments are closed for this entry.