Changeset 834

Show
Ignore:
Timestamp:
09/06/06 09:01:23 (2 years ago)
Author:
alban
Message:

add a -debug option

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/source/org/kolaka/freecast/Application.java

    r689 r834  
    4242import org.apache.commons.lang.builder.ToStringBuilder; 
    4343import org.apache.commons.logging.LogFactory; 
     44import org.apache.log4j.Category; 
     45import org.apache.log4j.Level; 
     46import org.apache.log4j.Logger; 
    4447import org.kolaka.freecast.config.ConfigurationLoader; 
    4548import org.kolaka.freecast.config.DefaultConfigurationLoader; 
     
    115118                options.addOption(dryrunOption); 
    116119 
     120    Option debugOption = new Option("debug", false, 
     121    "set log level to debug"); 
     122    options.addOption(debugOption); 
     123 
    117124                Option propertyOption = new Option("D", true, 
    118125                                "specifies a configuration property"); 
     
    135142                        return false; 
    136143                } 
     144 
     145    boolean debug = line.hasOption(debugOption.getOpt()); 
     146    if (debug) { 
     147      Logger.getLogger("org.kolaka.freecast").setLevel(Level.DEBUG); 
     148      LogFactory.getLog(getClass()).debug("debug level set by command line"); 
     149    } 
    137150 
    138151                boolean dryrun = line.hasOption(dryrunOption.getOpt());