Sunday Jan 23, 2011

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 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 (one file for an entire cluster).

Monday Aug 25, 2008

GlassFish log file too verbose? Sebastien has something for you.

sed 2.0!

Some people consider the content of a typical GlassFish log file too verbose. If you're one of them, Luxemburg's Sebastien Stormacq has something for you - a Sed-based filter. The short script can be applied (tail) to the log file directly or straight on the GlassFish standard output when starting in verbose mode.

On a similar note there's also the Log Viewer from the admin console which will also allow you to filter out based on time, content, severity, and more.

I guess sed (Stream EDitor) is the kind of tool Unix/Linux admins just can't go without. Interestingly enough, Sed is Turing-complete and can lead to interesting implementations.