當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。