Skip to main content

Configure logging from the command line in GFv3

Posted by kohsuke on June 29, 2007 at 6:33 PM PDT

Glassfish v3 is built by Maven 2, so most of the time the edit/build/debug cycle is as easy as:

$ mvn -o compile
$ mvn gf:run

Now, when I am debugging a problem, I often want to see more detailed logs that are recorded at INFO/CONFIG/FINE/etc levels. Unfortunately, the java.util.logging package doesn't make this very easy — you'd have to write a property file, and use a system property to specify that file. This is very tedious, IMO.

So I expanded the gf:run goal so that I can control logging settings from CLI. For example, if I want to see what's going on in com.sun.enterprise.module.maven.MavenProjectRepository, I might run:

$ mvn gf:run

And I get all the FINE level (and above) log messages for this class.

So far this is only available for the gf:run mojo, which is for those of us who are develping GFv3 and not the users, but I wonder if something like this makes sense for the production code, too. I mean, given that you can run GFv3 as java -jar glassfish.jar, when you are having some problems and trying to understand what's going on, wouldn't it be nice if you can try getting logging messages like that? It should also make it easy for us to support you — if I suspect some problems in some area, I'd just ask you to run it with -Dlogging.... option.

Related Topics >>