admin@glassfish.java.net

Re: CLICommand logger

From: Bill Shannon <bill.shannon_at_oracle.com>
Date: Tue, 31 Aug 2010 21:20:09 -0700

I've checked in the changes for this. CLILogger is *gone*!
I love removing code!

Note that this is an INCOMPATIBLE CHANGE for local asadmin commands.
I've updated all the commands in the workspace.

The "logger" protected field in an asadmin local command (extending CLICommand)
is now a java.util.logging.Logger. You can use the normal Logger methods to
display messages. Normal output uses the "info" level, debug output uses the
"finer" level, non-terse output uses the "fine" level.

Here's the shell script that I used to convert the existing commands:

#!/bin/sh
ed - $1 <<'EOF'
g/printError/s//severe/
g/printWarning/s//warning/
g/printMessage/s//info/
g/printDetailMessage/s//fine/
g/printDebugMessage/s//finer/
g/printTraceMessage/s//finest/
g/logger.isDebug()/s/isDebug()/isLoggable(Level.FINER)/
g/logger.printExceptionStackTrace/s/logger.print/print/
w
q
EOF

Let me know if you see any problems related to this.



Bill Shannon wrote on 8/17/10 12:27 AM:
> I haven't heard any objections, so I'll start working on this...
>
> Bill Shannon wrote on 08/13/2010 03:38 PM:
>> One of the things that's always bothered me is that local asadmin commands
>> (subclassing CLICommand) use a completely different logging mechanism
>> (CLILogger) from that used for classes in the server. I'd like to change
>> that.
>>
>> I'd like to get rid of CLILogger and let classes use a normal Logger to
>> log output. Don't worry, I'll change all the existing classes.
>>
>> Does anyone object if I make this change?
>