public static void logCommandLineOptions ( Logger logger , CommandLine line ) { for ( Option myOption : line . getOptions ( ) ) { String message ; String opt = "" ; if ( myOption . getOpt ( ) != null ) { opt += "-" + myOption . getOpt ( ) ; if ( myOption . getLongOpt ( ) != null ) opt += " (--" + myOption . getLongOpt ( ) + ")" ; } else opt += "--" + myOption . getLongOpt ( ) + "" ; if ( myOption . hasArg ( ) ) message = opt + " " + myOption . getValue ( ) ; else message = opt ; logger . info ( "with option: " + message ) ; } }
Displays all command line options in log messages .