当前位置: 首页>>代码示例>>Java>>正文


Java ConsoleAppender.setName方法代码示例

本文整理汇总了Java中org.apache.log4j.ConsoleAppender.setName方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleAppender.setName方法的具体用法?Java ConsoleAppender.setName怎么用?Java ConsoleAppender.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.log4j.ConsoleAppender的用法示例。


在下文中一共展示了ConsoleAppender.setName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	System.setProperty("log4j.defaultInitOverride", "true");
	LogManager.resetConfiguration();
	ConsoleAppender ca = new ConsoleAppender(new PatternLayout("%-5p - %m%n"));
	ca.setName("edits");
	LogManager.getRootLogger().addAppender(ca);
	Options ops = new Options();
	ops.addOption("optimize", false, "");
	ops.addOption("balance", false, "");
	ops.addOption("rules", false, "");
	ops.addOption("debug", false, "");
	ops.addOption("wordnet", true, "");

	CommandLine commandLine = new BasicParser().parse(ops, args);

	if (!commandLine.hasOption("debug"))
		ca.setThreshold(Level.INFO);

	RunExperiment res = new RunExperiment(commandLine.getArgs()[0], commandLine.hasOption("balance"),
			commandLine.hasOption("optimize"), commandLine.hasOption("rules"));

	if (commandLine.hasOption("wordnet"))
		res.setRulesSource(new WordnetRulesSource(commandLine.getOptionValue("wordnet")));

	res.train(commandLine.getArgs()[1]);
}
 
开发者ID:kouylekov,项目名称:edits,代码行数:27,代码来源:RunExperiment.java

示例2: setUp

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
public void setUp() {
  	System.setProperty( "javax.net.ssl.keyStore",  TlsTest.class.getResource("testkeys").getPath() );
System.setProperty( "javax.net.ssl.trustStore", TlsTest.class.getResource("testkeys").getPath() );
System.setProperty( "javax.net.ssl.keyStorePassword", "passphrase" );
System.setProperty( "javax.net.ssl.keyStoreType", "jks" );
  	ConsoleAppender console = new ConsoleAppender();
  	console.setName("Console app");
  	String PATTERN = "%d [%p|%c|%C{1}] %m%n";
  	console.setLayout(new PatternLayout(PATTERN)); 
  	console.setThreshold(Level.DEBUG);
  	console.activateOptions();
  	Logger.getRootLogger().addAppender(console);
  	this.websocketServer = new WebsocketServer();
  	this.websocketBrowser = new WebsocketBrowser();
  }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:16,代码来源:WebsocketSelfTest.java

示例3: loggerSetup

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
/**
    * Just some logging set up here.
    */
   private void loggerSetup() {
logger = TesttoolConfig.getLogger();
logger.setLevel(Level.INFO);

console = Logger.getLogger("de.wwu.testtool.test.console");
console.setLevel(Level.INFO);

ConsoleAppender consoleAppender = new ConsoleAppender(new PatternLayout("%-5p [%t:%r] %M(): %m%n"));
consoleAppender.setName("Console Appender");
//consoleAppender.setLayout(new PatternLayout("[%r] %20.20M(): %m%n") );
consoleAppender.setLayout(new PatternLayout("%m%n") );
console.addAppender(consoleAppender);
   }
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:17,代码来源:DiplomaThesis.java

示例4: loggerSetup

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
private void loggerSetup() {
logger = TesttoolConfig.getLogger();
logger.setLevel(Level.DEBUG);
logger.debug("Debug");
logger.info("Info");

console = Logger.getLogger("de.wwu.testtool.test.console");
console.setLevel(Level.INFO);
ConsoleAppender consoleAppender = new ConsoleAppender(new PatternLayout("%-5p [%t:%r] %M(): %m%n"));
consoleAppender.setName("Console Appender");
consoleAppender.setLayout(new PatternLayout("[%r] %20.20M(): %m%n") );
console.addAppender(consoleAppender);

   }
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:15,代码来源:SimplexSolverTest.java

示例5: SetConsoleLogger

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
public static void SetConsoleLogger(Level level) {
    ConsoleAppender ca = new ConsoleAppender();
    ca.setThreshold(level);
    ca.setName("ConsoleLogger_Info");
    ca.setLayout(new PatternLayout("%d %-5p [%c{1}] %m%n"));
    ca.activateOptions();
    Logger.getRootLogger().getLoggerRepository().resetConfiguration();
    Logger.getRootLogger().addAppender(ca);
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:10,代码来源:ConsoleLogger.java

示例6: initConsoleLog

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
/**
 * Defines an appender that writes INFO log messages to the console.
 */
public static void initConsoleLog()
{
  ConsoleAppender consoleAppender = new ConsoleAppender();
  consoleAppender.setName("ConsoleLogger");
  consoleAppender.setLayout(new PatternLayout(" [%p] %d [%t] %x %c %M - %m%n"));
  LevelRangeFilter levelRangeFilter = new LevelRangeFilter();
  levelRangeFilter.setLevelMax(Level.INFO);
  levelRangeFilter.setLevelMin(Level.INFO);
  consoleAppender.addFilter(levelRangeFilter);
  consoleAppender.activateOptions();
  Logger.getRootLogger().addAppender(consoleAppender);
}
 
开发者ID:Wikidata,项目名称:QueryAnalysis,代码行数:16,代码来源:LoggingHandler.java

示例7: configureLog4J

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
public static void configureLog4J()
{
    Logger root = Logger.getRootLogger();
   	root.setLevel(Level.DEBUG);
   	ConsoleAppender consoleAppender = new ConsoleAppender(new PatternLayout("%d{HH:mm:ss.SSS} %c{2} [%t] %p - %m%n"));
   	consoleAppender.setName("CONSOLE");
   	if (root.getAppender("CONSOLE") == null)
   		root.addAppender(consoleAppender);
   	Logger.getLogger("org.logicalcobwebs").setLevel(Level.WARN);
}
 
开发者ID:omry,项目名称:mysql_monk,代码行数:11,代码来源:MysqlMonk.java

示例8: initConsoleLog

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
/**
 * Defines an appender that writes INFO log messages to the console.
 */
public static void initConsoleLog() {
    ConsoleAppender consoleAppender = new ConsoleAppender();
    consoleAppender.setName("ConsoleLogger");
    consoleAppender.setLayout(new PatternLayout("[%-5p]\t%d\t%c\t%x\t-\t%m%n"));
    LevelRangeFilter levelRangeFilter = new LevelRangeFilter();
    consoleAppender.addFilter(levelRangeFilter);
    consoleAppender.activateOptions();
    Logger.getRootLogger().addAppender(consoleAppender);
}
 
开发者ID:jgonsior,项目名称:AngryProgrammers,代码行数:13,代码来源:LoggingHandler.java

示例9: configureLog4J

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
/**
 * Configures the Log4J properties
 * 
 * @param logFilePath
 *            The log file path
 */
private void configureLog4J(String logFilePath) {

	// This is the root logger provided by log4j
	Logger rootLogger = Logger.getRootLogger();
	rootLogger.setLevel(Level.DEBUG);

	// Define log pattern layout
	PatternLayout layout = new PatternLayout("[%-5p] %d %c - %m%n");

	// Add console appender to root logger
	if (rootLogger.getAppender(LOG_CONSOLE_APPENDER_NAME) == null) {
		ConsoleAppender consoleAppender = new ConsoleAppender(layout);
		consoleAppender.setName(LOG_CONSOLE_APPENDER_NAME);
		rootLogger.addAppender(consoleAppender);
	}

	// Add file appender with layout and output log file name
	try {
		if (rootLogger.getAppender(LOG_FILE_APPENDER_NAME) == null) {
			RollingFileAppender fileAppender = new RollingFileAppender(
					layout, logFilePath);
			fileAppender.setAppend(false);
			fileAppender.setImmediateFlush(true);
			fileAppender.setName(LOG_FILE_APPENDER_NAME);
			fileAppender.setMaxFileSize("5MB");
			fileAppender.setMaxBackupIndex(10);
			rootLogger.addAppender(fileAppender);
		}
	} catch (IOException e) {
		System.out.println("Failed to add appender !!");
	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:39,代码来源:Resources.java

示例10: installConsoleAppender

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
private void installConsoleAppender() {
    ConsoleAppender console = new ConsoleAppender();
    console.setName("Console");
    console.setThreshold(logLevel);
    console.setLayout(new PatternLayout(PATTERN));
    console.setFollow(true);
    console.activateOptions();

    Logger.getRootLogger().addAppender(console);
}
 
开发者ID:sterodium,项目名称:selenium-grid-extensions,代码行数:11,代码来源:LoggingConfigurator.java

示例11: createConsoleAppender

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
private void createConsoleAppender() {
  ConsoleAppender appender = new ConsoleAppender();
  appender.setName(STRING_APPENDER_NAME);
  appender.setLayout(new PatternLayout(
      "%-5p %d{yyyy-MM-dd HH:mm:ss.SSS 'GMT'Z} %c{1} [%t] - %m%n"));
  appender.activateOptions();
  appender.setThreshold(Level.DEBUG);
  Logger.getLogger(ImJavaApiLogger.class).addAppender(appender);
}
 
开发者ID:indigo-dc,项目名称:im-java-api,代码行数:10,代码来源:ImTestWatcher.java

示例12: setUp

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();

    Logger defaultLogger = Logger.getLogger(StopWatch.DEFAULT_LOGGER_NAME);
    ConsoleAppender stdErrAppender = new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_ERR);
    stdErrAppender.setName("log4jStdErrAppender");
    stdErrAppender.activateOptions();
    defaultLogger.addAppender(stdErrAppender);
}
 
开发者ID:codehaus,项目名称:perf4j,代码行数:10,代码来源:Log4JStopWatchTest.java

示例13: solverManagerTest

import org.apache.log4j.ConsoleAppender; //导入方法依赖的package包/类
public void solverManagerTest() {
	// set up logging and solver manager
	logger = TesttoolConfig.getLogger();
	logger.setLevel(Level.TRACE);
	texLogger = TesttoolConfig.getTexLogger();
	texLogger.setLevel(Level.DEBUG);
	console = Logger.getLogger("de.wwu.testtool.test.console");
	console.setLevel(Level.DEBUG);
	ConsoleAppender consoleAppender = new ConsoleAppender(new PatternLayout("%-5p [%t:%r] %M(): %m%n"));
	consoleAppender.setName("Console Appender");
	consoleAppender.setLayout(new PatternLayout("[%r] %20.20M(): %m%n") );
	console.addAppender(consoleAppender);

	// setup some stuff
	solverManager = new SolverManagerOld();
	ConstraintExpression constraint = null;
	
	// linear program with doubles
//	constraint = this.simpleLinearProgramDouble();	
//	solverManager.addConstraint(constraint);
//	this.solve();
//	solverManager.removeConstraint();

	// linear program with integer
//	constraint = this.simpleLinearProgramInteger();
//	solverManager.addConstraint(constraint);
//	this.solve();
//	solverManager.removeConstraint();
	
	// linear program with integer
//	constraint = this.simpleLinearProgramInteger2();
//	solverManager.addConstraint(constraint);
//	this.solve();
//	solverManager.removeConstraint();

	// transformation tests
	constraint = this.transformationTest();
	solverManager.addConstraint(constraint);
	//solverManager.addConstraint( Not.newInstance(constraint) );
	//solverManager.addConstraint( this.simpleLinearProgramDouble() );
	this.solve();
	//solverManager.removeConstraint();
	//solverManager.removeConstraint();
	solverManager.removeConstraint();
	
	// type casts
//	constraint = this.simpleExpressionWithTypeCasts();
//	solverManager.addConstraint(constraint);
//	this.solve();
//	solverManager.removeConstraint();
	
	// non linear
//	constraint = this.simpleNonLinearProgram();
//	solverManager.addConstraint(constraint);
//	this.solve();
//	solverManager.removeConstraint();
	
	// boolean mixed with linear double
//	constraint = this.simpleLinearProgramDouble();
//	solverManager.addConstraint(Xor.newInstance(this.booleanTest(), constraint));
//	this.solve();
//	solverManager.removeConstraint();
	
	// boolean
//	solverManager.addConstraint(this.booleanTest());
//	this.solve();
//	solverManager.removeConstraint();
	
	// boolean combined with linear
//	constraint = BooleanEqual.newInstance(Not.newInstance(constraint), this.booleanTest());
//	solverManager.addConstraint(constraint);
//	this.solve();
//	solverManager.removeConstraint();
    }
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:75,代码来源:ExampleProblems.java


注:本文中的org.apache.log4j.ConsoleAppender.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。