本文整理汇总了Java中org.apache.jorphan.logging.LoggingManager.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java LoggingManager.setPriority方法的具体用法?Java LoggingManager.setPriority怎么用?Java LoggingManager.setPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jorphan.logging.LoggingManager
的用法示例。
在下文中一共展示了LoggingManager.setPriority方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.jorphan.logging.LoggingManager; //导入方法依赖的package包/类
public static void main(String args[]){
int port = HttpMirrorControl.DEFAULT_PORT;
if (args.length > 0){
port = Integer.parseInt(args[0]);
}
LoggingManager.setPriority("INFO"); // default level
LoggingManager.setLoggingLevels(System.getProperties() ); // allow override by system properties
HttpMirrorServer serv = new HttpMirrorServer(port);
serv.start();
}
示例2: processParams
import org.apache.jorphan.logging.LoggingManager; //导入方法依赖的package包/类
protected int processParams(ListIterator<?> args)
throws UnsupportedOperationException, IllegalArgumentException {
LoggingManager.setPriority(Priority.INFO);
PerfMonWorker worker;
try {
worker = getWorker();
} catch (IOException ex) {
log.error("Error", ex);
return 0;
}
while (args.hasNext()) {
String nextArg = (String) args.next();
log.debug("Arg: " + nextArg);
if (nextArg.equalsIgnoreCase("--tcp-port")) {
if (!args.hasNext()) {
throw new IllegalArgumentException("Missing TCP Port no");
}
worker.setTCPPort(Integer.parseInt((String) args.next()));
} else if (nextArg.equals("--loglevel")) {
args.remove();
String loglevelStr = (String) args.next();
LoggingManager.setPriority(loglevelStr);
} else if (nextArg.equalsIgnoreCase("--interval")) {
if (!args.hasNext()) {
throw new IllegalArgumentException("Missing interval specification");
}
worker.setInterval(Long.parseLong((String) args.next()));
} else if (nextArg.equalsIgnoreCase("--udp-port")) {
if (!args.hasNext()) {
throw new IllegalArgumentException("Missing UDP Port no");
}
worker.setUDPPort(Integer.parseInt((String) args.next()));
} else if (nextArg.equals("--auto-shutdown")) {
args.remove();
worker.setAutoShutdown();
} else if (nextArg.equals("--sysinfo")) {
args.remove();
worker.logSysInfo();
} else if (nextArg.equals("--agent-version")) {
args.remove();
worker.logVersion();
} else {
throw new UnsupportedOperationException("Unrecognized option: " + nextArg);
}
}
try {
worker.startAcceptingCommands();
while (!worker.isFinished()) {
worker.processCommands();
}
} catch (IOException e) {
log.error("Error", e);
return 0;
}
return worker.getExitCode();
}
示例3: runJMeter
import org.apache.jorphan.logging.LoggingManager; //导入方法依赖的package包/类
protected void runJMeter(String className) throws Exception {
int iterations = Integer.valueOf(getTestConfiguration(className, "iterations", "1"));
int threads = Integer.valueOf(getTestConfiguration(className, "threads", "1"));
log.info("starting test " + StringUtils.substringAfterLast(className, "."));
// loop controller
LoopController loopController = new LoopController();
loopController.setLoops(iterations);
loopController.setFirst(true);
loopController.initialize();
// thread group
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setNumThreads(threads);
threadGroup.setRampUp(1);
threadGroup.setSamplerController(loopController);
// JavaSampler
JavaSampler javaSampler = new JavaSampler();
javaSampler.setClassname(className);
javaSampler.setArguments(arguments);
// summary
Summariser summariser = new Summariser("summary");
ResultCollector logger = new ResultCollector(summariser);
// simple listener to track if at least one test failed
GlobalResult globalResult = new GlobalResult();
// create test plan
TestPlan testPlan = new TestPlan();
// assemble the test plan from previously initialized elements
HashTree testPlanHashTree = new HashTree();
testPlanHashTree.add(testPlan);
HashTree threadGroupHashTree = new HashTree();
threadGroupHashTree = testPlanHashTree.add(testPlan, threadGroup);
HashTree javaSamplerHashTree = new HashTree();
javaSamplerHashTree = threadGroupHashTree.add(javaSampler);
javaSamplerHashTree.add(logger);
javaSamplerHashTree.add(globalResult);
// start JMeter test
StandardJMeterEngine jmeter = new StandardJMeterEngine();
jmeter.configure(testPlanHashTree);
jmeter.run();
// increase log level to display the final summary
LoggingManager.setPriority(Priority.INFO, "jmeter.reporters.Summariser");
logger.testEnded();
LoggingManager.setPriority(Priority.WARN, "jmeter.reporters.Summariser");
// set the JUnit test result
assertTrue(!globalResult.isFailed());
}
示例4: setUp
import org.apache.jorphan.logging.LoggingManager; //导入方法依赖的package包/类
@Override
public void setUp(){
LoggingManager.setPriority("FATAL_ERROR",LoggingManager.removePrefix(Functor.class.getName()));
}