crafterm 2002/10/23 05:04:16 Modified: xfc/src/java/org/apache/excalibur/xfc Main.java Log: Added command line option to (dis)enable debug logging to the console. Revision Changes Path 1.3 +16 -5 jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/Main.java Index: Main.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/Main.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Main.java 16 Oct 2002 16:21:07 -0000 1.2 +++ Main.java 23 Oct 2002 12:04:16 -0000 1.3 @@ -52,6 +52,7 @@ import java.util.List; import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.NullLogger; import org.apache.avalon.framework.logger.Logger; import org.apache.avalon.excalibur.cli.CLArgsParser; @@ -73,6 +74,7 @@ private static final int VERSION_OPT = 'v'; private static final int INPUT_OPT = 'i'; private static final int OUTPUT_OPT = 'o'; + private static final int DEBUG_OPT = 'd'; // Array of understood options, for setting the input and output // conversion modules @@ -94,10 +96,14 @@ CLOptionDescriptor.ARGUMENT_REQUIRED, OUTPUT_OPT, "set the output module name and context" ), + new CLOptionDescriptor( "debug", + CLOptionDescriptor.ARGUMENT_DISALLOWED, + DEBUG_OPT, + "enable debug logging" ), }; - // Logger for output. REVISIT(MC): add debug option for debug logging - private static final Logger m_logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); + // Logger for output. + private static Logger m_logger = new NullLogger(); // Input module name private static String m_inputModule; @@ -168,8 +174,8 @@ final List options = parser.getArguments(); final int size = options.size(); - // Check that there are enough arguments (should be no more than 2) - if ( size > 2 ) + // Check that there are enough arguments (should be no more than 3) + if ( size > 3 ) { printUsage(); } @@ -183,6 +189,11 @@ case CLOption.TEXT_ARGUMENT: // This occurs when a user supplies an unknown argument System.err.println( "Unknown argument: " + option.getArgument() ); + break; + + case DEBUG_OPT: + // Modify the logger to print debug output to console + m_logger = new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG ); break; case HELP_OPT:
-- To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>