本文整理汇总了Java中org.apache.log4j.Level.INFO属性的典型用法代码示例。如果您正苦于以下问题:Java Level.INFO属性的具体用法?Java Level.INFO怎么用?Java Level.INFO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.log4j.Level
的用法示例。
在下文中一共展示了Level.INFO属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: comboTest
/**
* Executes multiple runs for a set of models.
* The seeds used for model generation and for simulation
* are automatically generated.
* @param classN number of classes for each random model
* @param statN number of stations for each random model
* @param modelN number of random models
* @param modelType type of random models
* @param simRuns number of simulation runs for each model
*/
public static void comboTest(int classN, int statN, int modelN, int modelType, int simRuns) {
//debug level = INFO with extended info.
BatchTest btest = new BatchTest(Level.INFO, true);
for (int m = 0; m < modelN; m++) {
//Creates a random model of the specified type
//uses automatic seed for model generation
RandomMVAModelGenerator randomGen = new RandomMVAModelGenerator(classN, statN, modelType, -1);
File model = randomGen.saveToFile();
//result check with extended info
ResultsCheck check = new ResultsCheck(model.getAbsolutePath(), true);
//multiple runs
check.checkRes(simRuns);
}
}
示例2: test_fixedModelSeed
/**
* Executes multiple runs for one model, generated with the passed seed.
* The seed used for simulations is automatically generated.
* @param classN number of classes for the random model
* @param statN number of stations for the random model
* @param modelGenSeed the seed used to generate the random model
* @param modelType type of random model
* @param simRuns number of simulation runs for the model
*/
public static void test_fixedModelSeed(int classN, int statN, long modelGenSeed, int modelType, int simRuns) {
//debug level = INFO with extended info.
BatchTest btest = new BatchTest(Level.INFO, true);
//Creates a random model of the specified type
//uses passed seed for model generation
RandomMVAModelGenerator randomGen = new RandomMVAModelGenerator(classN, statN, modelType, modelGenSeed);
File model = randomGen.saveToFile();
//result check with extended info
ResultsCheck check = new ResultsCheck(model.getAbsolutePath(), true);
//multiple runs (of course with automatic seed)
check.checkRes(simRuns);
}
示例3: test_fixedSimSeed
/**
* Executes a single test with the passed simulation seed. The seeds used
* for model generation is automatically generated.
* @param classN number of classes for each random model
* @param statN number of stations for each random model
* @param modelType type of random models
* @param simSeed the simulation seed
*/
public static void test_fixedSimSeed(int classN, int statN, int modelType, long simSeed) {
//debug level = INFO with extended info.
BatchTest btest = new BatchTest(Level.INFO, true);
//Creates a random model of the specified type
//uses automatic seed for model generation
RandomMVAModelGenerator randomGen = new RandomMVAModelGenerator(classN, statN, modelType, -1);
File model = randomGen.saveToFile();
//result check with extended info and fixed seed
ResultsCheck check = new ResultsCheck(model.getAbsolutePath(), true, simSeed);
//fixed seed -> only one run
check.checkRes();
}
示例4: test_fixedSimSeedAndModelSeed
/**
* Executes a single test with the passed seeds for model generation and for simulation.
* @param classN number of classes for each random model
* @param statN number of stations for each random model
* @param modelGenSeed the seed used to generate the random model
* @param modelType type of random models
* @param simSeed the simulation seed
*/
public static void test_fixedSimSeedAndModelSeed(int classN, int statN, long modelGenSeed, int modelType, long simSeed) {
//debug level = INFO with extended info.
BatchTest btest = new BatchTest(Level.INFO, true);
//Creates a random model of the specified type
//uses the fixed seed for model generation
RandomMVAModelGenerator randomGen = new RandomMVAModelGenerator(classN, statN, modelType, modelGenSeed);
File model = randomGen.saveToFile();
//result check with extended info and fixed seed
ResultsCheck check = new ResultsCheck(model.getAbsolutePath(), true, simSeed);
//fixed seed -> only one run
check.checkRes();
}
示例5: test_fixedSimSeedAndModelSeed_runs
/**
* Executes a single test with the passed seeds for model generation and for simulation.
* Of course all the sim runs will be exactly the same: this method is used only to
* test jsim performance.
* @param classN number of classes for each random model
* @param statN number of stations for each random model
* @param modelGenSeed the seed used to generate the random model
* @param modelType type of random models
* @param runs number of runs
* @param simSeed the simulation seed
*/
public static void test_fixedSimSeedAndModelSeed_runs(int classN, int statN, long modelGenSeed, int modelType, int runs, long simSeed) {
//debug level = INFO with extended info.
BatchTest btest = new BatchTest(Level.INFO, true);
//Creates a random model of the specified type
//uses the fixed seed for model generation
RandomMVAModelGenerator randomGen = new RandomMVAModelGenerator(classN, statN, modelType, modelGenSeed);
File model = randomGen.saveToFile();
//result check with extended info and fixed seed
ResultsCheck check = new ResultsCheck(model.getAbsolutePath(), true, simSeed);
//fixed seed -> only one run
check.checkRes(runs);
}
示例6: format
public String format(LoggingEvent event){
if( event.getLevel() == Level.FATAL){
return fatalErrorColor+super.format(event)+END_COLOR;
}else if( event.getLevel() == Level.ERROR){
return errorColor+super.format(event)+END_COLOR;
}if( event.getLevel() == Level.WARN){
return super.format(event);
// return warnColor+super.format(event)+END_COLOR;
}if( event.getLevel() == Level.INFO){
return super.format(event);
// return infoColor+super.format(event)+END_COLOR;
}if( event.getLevel() == Level.DEBUG){
return super.format(event);
// return debugColor+super.format(event)+END_COLOR;
}else{
throw new RuntimeException("Unsupported Level "+event.toString());
}
}
示例7: intToLevel
public static Level intToLevel(int intLevel) {
switch(intLevel) {
case TRACE_INFO: return Level.INFO;
case TRACE_DEBUG: return Level.DEBUG;
case TRACE_ERROR: return Level.ERROR;
case TRACE_WARN: return Level.WARN;
case TRACE_TRACE: return Level.TRACE;
case TRACE_FATAL: return Level.FATAL;
}
return Level.OFF;
}
示例8: getLevel
public Level getLevel(int traceLevel) {
if ( traceLevel == TRACE_INFO ) {
return Level.INFO;
} else if ( traceLevel == TRACE_ERROR ) {
return Level.ERROR;
} else if ( traceLevel == TRACE_DEBUG) {
return Level.DEBUG;
} else if (traceLevel == TRACE_TRACE) {
return Level.ALL;
} else {
return Level.OFF;
}
}
示例9: setLogLevel
private void setLogLevel(String level) {
Level newLevel = Level.ERROR;
level = level.substring(level.lastIndexOf(' ') + 1);
switch (level) {
case "Debug":
newLevel = Level.DEBUG;
break;
case "Info":
newLevel = Level.INFO;
break;
case "Warn":
newLevel = Level.WARN;
break;
case "Error":
newLevel = Level.ERROR;
break;
}
Logger.getRootLogger().setLevel(newLevel);
logger.setLevel(newLevel);
ConsoleAppender ca = (ConsoleAppender)Logger.getRootLogger().getAppender("stdout");
if (ca != null) {
ca.setThreshold(newLevel);
}
FileAppender fa = (FileAppender)Logger.getRootLogger().getAppender("FILE");
if (fa != null) {
fa.setThreshold(newLevel);
}
}
示例10: determineLogLevel
/**
* Determines the log level represented by the configuration setting. If the
* stored value does not match any of the supported log levels, the default
* log level INFO will be used.
*
* @param logLevel
* The log level information read from the configuration
* settings.
* @return The log4j compliant log level to be used.
*/
private static Level determineLogLevel(String logLevel) {
Level level = Level.INFO;
if (DEBUG_LOG_LEVEL.equals(logLevel)) {
level = Level.DEBUG;
} else if (WARN_LOG_LEVEL.equals(logLevel)) {
level = Level.WARN;
} else if (ERROR_LOG_LEVEL.equals(logLevel)) {
level = Level.ERROR;
} else if (INFO_LOG_LEVEL.equals(logLevel)) {
level = Level.INFO;
}
return level;
}
示例11: writeToLog
@Override
public synchronized void writeToLog(int messageLogLevel, String message) {
Priority priority = Level.TRACE;
if (messageLogLevel == Log.LOGLEVEL_FATAL_ERROR) priority = Level.FATAL;
else if (messageLogLevel == Log.LOGLEVEL_EXCEPTION) priority = Level.ERROR;
else if (messageLogLevel == Log.LOGLEVEL_WARNING) priority = Level.WARN;
else if (messageLogLevel == Log.LOGLEVEL_MESSAGE) priority = Level.INFO;
else if (messageLogLevel == Log.LOGLEVEL_DEBUG) priority = Level.DEBUG;
else if (messageLogLevel == Log.LOGLEVEL_DEBUG2) priority = Level.TRACE;
else if (messageLogLevel == Log.LOGLEVEL_DEBUG3) priority = Level.TRACE;
logger.log(priority, message);
}
示例12: setLogLevel
/**
* Set logging level to given value. If not explicitly
* specified, default level is used from *logger* properties file.
* (As of the time writing - simplelogger.properties is used as default.)
* <p/>
* NOTE: SLF4J is not capable of changing log levels programatically!
* We have to change the System/File property of given underlying logger.
*
* @param logLevel logging level to be logger set to
*/
public static void setLogLevel(String logLevel) {
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("com.redhat.mqe.jms");
Level level;
switch (logLevel.toLowerCase()) {
case "all":
level = Level.ALL;
break;
case "trace":
level = Level.TRACE;
break;
case "debug":
level = Level.DEBUG;
break;
case "info":
level = Level.INFO;
break;
case "warn":
level = Level.WARN;
break;
case "error":
level = Level.ERROR;
break;
case "fatal":
level = Level.FATAL;
break;
case "off":
level = Level.OFF;
break;
default:
level = Level.INFO;
}
LogManager.getRootLogger().setLevel(level);
logger.setLevel(level);
}
示例13: test_fixedPath
public static void test_fixedPath(String path) {
BatchTest btest = new BatchTest(Level.INFO, true);
ResultsCheck check = new ResultsCheck(path, true);
check.checkRes();
}