Changeset 5391 for CMDIValidator


Ignore:
Timestamp:
06/26/14 12:12:43 (10 years ago)
Author:
Oliver Schonefeld
Message:
  • add command line option to enable full debugging (level trace)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMDIValidator/trunk/cmdi-validator-tool/src/main/java/eu/clarin/cmdi/validator/tool/CMDIValidatorTool.java

    r5387 r5391  
    5757    private static final Locale LOCALE                   = Locale.ENGLISH;
    5858    private static final char OPT_DEBUG                  = 'd';
     59    private static final char OPT_DEBUG_TRACE            = 'D';
    5960    private static final char OPT_QUIET                  = 'q';
    6061    private static final char OPT_VERBOSE                = 'v';
     
    7677         * application defaults
    7778         */
    78         boolean debugging         = false;
     79        int debugging             = 0;
    7980        boolean quiet             = false;
    8081        boolean verbose           = false;
     
    114115            // extract options
    115116            if (line.hasOption(OPT_DEBUG)) {
    116                 debugging = true;
     117                debugging = 1;
     118            }
     119            if (line.hasOption(OPT_DEBUG_TRACE)) {
     120                debugging = 2;
    117121            }
    118122            if (line.hasOption(OPT_QUIET)) {
     
    178182                    org.apache.log4j.Logger.getLogger(
    179183                            CMDIValidator.class.getPackage().getName());
    180             if (debugging) {
     184            if (debugging > 0) {
    181185                appender.setLayout(
    182186                        new org.apache.log4j.PatternLayout("[%p] %t: %m%n"));
    183                 log.setLevel(org.apache.log4j.Level.DEBUG);
     187                if (debugging > 1) {
     188                    log.setLevel(org.apache.log4j.Level.TRACE);
     189                } else {
     190                    log.setLevel(org.apache.log4j.Level.DEBUG);
     191                }
    184192            } else {
    185193                if (quiet) {
     
    346354        } catch (CMDIValidatorException e) {
    347355            logger.error("error initalizing job: {}", e.getMessage());
    348             if (debugging) {
     356            if (debugging > 0) {
    349357                logger.error(e.getMessage(), e);
    350358            }
     
    352360        } catch (CMDIValidatorInitException e) {
    353361            logger.error("error initializing validator: {}", e.getMessage());
    354             if (debugging) {
     362            if (debugging > 0) {
    355363                logger.error(e.getMessage(), e);
    356364            }
     
    381389                .withLongOpt("debug")
    382390                .create(OPT_DEBUG));
     391        g1.addOption(OptionBuilder
     392                .withDescription("enable full debugging output")
     393                .withLongOpt("trace")
     394                .create(OPT_DEBUG_TRACE));
    383395        g1.addOption(OptionBuilder
    384396                .withDescription("be quiet")
Note: See TracChangeset for help on using the changeset viewer.