• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DenyAllFilter类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.log4j.varia.DenyAllFilter的典型用法代码示例。如果您正苦于以下问题:Java DenyAllFilter类的具体用法?Java DenyAllFilter怎么用?Java DenyAllFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DenyAllFilter类属于org.apache.log4j.varia包,在下文中一共展示了DenyAllFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ConsoleInput

点赞 3

import org.apache.log4j.varia.DenyAllFilter; //导入依赖的package包/类
/**
	 * Simple constructor to allow other components to use the console commands such as "set"
	 * @param con
	 * @param _azureus_core
	 * @param _out
	 */

public ConsoleInput(AzureusCore _azureus_core, PrintStream _out )
{
	super( "" );
	this.out = _out;
	this.azureus_core	= _azureus_core;
	this.userProfile 	= UserProfile.DEFAULT_USER_PROFILE;
	this.controlling 	= false;
	this.br 			= new CommandReader( new InputStreamReader( new ByteArrayInputStream(new byte[0])));
			
	if (Logger.getRootLogger().getAppender("ConsoleAppender")==null) {
      Appender app;
      app = new ConsoleAppender(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
      app.setName("ConsoleAppender");
      app.addFilter( new DenyAllFilter() );  //'log off' by default
      Logger.getRootLogger().addAppender(app);
    }
	
	initialise();
}
 

开发者ID:AcademicTorrents,
项目名称:AcademicTorrents-Downloader,
代码行数:27,
代码来源:ConsoleInput.java

示例2: accept

点赞 2

import org.apache.log4j.varia.DenyAllFilter; //导入依赖的package包/类
public void accept() throws Exception {
  
  // set up appender
  Layout layout = new SimpleLayout();
  Appender appender = new FileAppender(layout, ACCEPT_FILE, false);
  
  // create LevelMatchFilter
  LevelMatchFilter matchFilter = new LevelMatchFilter();
 
   // attach match filter to appender
  appender.addFilter(matchFilter);
 
  // attach DenyAllFilter to end of filter chain to deny neutral
  // (non matching) messages
  appender.addFilter(new DenyAllFilter());
      
  // set appender on root and set level to debug
  root.addAppender(appender);
  root.setLevel(Level.TRACE);
  
  Level[] levelArray = new Level[] {Level.TRACE, Level.DEBUG, Level.INFO, Level.WARN, 
		      Level.ERROR, Level.FATAL};
  for (int x = 0; x < levelArray.length; x++) {
    // set the level to match
    matchFilter.setLevelToMatch(levelArray[x].toString());
    common("pass " + x + "; filter set to accept only " 
    + levelArray[x].toString() + " msgs");
  }
  
  Transformer.transform(ACCEPT_FILE, ACCEPT_FILTERED, new LineNumberFilter());
  assertTrue(Compare.compare(ACCEPT_FILTERED, ACCEPT_WITNESS));
}
 

开发者ID:cacheonix,
项目名称:cacheonix-core,
代码行数:33,
代码来源:LevelMatchFilterTestCase.java

示例3: initRootLogger

点赞 2

import org.apache.log4j.varia.DenyAllFilter; //导入依赖的package包/类
public static void initRootLogger() {
  if (Logger.getRootLogger().getAppender("ConsoleAppender")==null) {
    Appender app;
    app = new ConsoleAppender(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
    app.setName("ConsoleAppender");
    app.addFilter( new DenyAllFilter() );  //'log off' by default
    Logger.getRootLogger().addAppender(app);
  }
}
 

开发者ID:AcademicTorrents,
项目名称:AcademicTorrents-Downloader,
代码行数:10,
代码来源:Main.java

示例4: init

点赞 2

import org.apache.log4j.varia.DenyAllFilter; //导入依赖的package包/类
/**
 */
private void init()
{
   super.setDefaultLayoutPattern(DEFAULT_LAYOUT_PATTERN);
   super.setAutoFlushMode(true);
   // Create a DenyAllFilter to prevent the StandaloneFileAppenderComponent from receiving general log 
   // messages, if added to a LogManager.
   super.addFilter(new DenyAllFilter());
}
 

开发者ID:tolo,
项目名称:JServer,
代码行数:11,
代码来源:StandaloneFileAppenderComponent.java

示例5: configure

点赞 2

import org.apache.log4j.varia.DenyAllFilter; //导入依赖的package包/类
static void configure() {
    final LogAppendersSet appendersSet = AuditConfiguration.LOG_APPENDER.getValue(LogAppendersSet.class);

    if (appendersSet == null || appendersSet.isEmpty()) {
        throw new AuditLoggingException("No audit appenders configured.");
    }

    if (appendersSet.size() > 1 && appendersSet.contains(LogAppenders.NONE)) {
        throw new AuditLoggingException("Invalid configuration: none appender is used with other simultaneously.");
    }

    final RewriteAppender auditAppender = new RewriteAppender();

    for (LogAppenders appender : appendersSet) {
        switch (appender) {
        case FILE:
            auditAppender.addAppender(rollingFileAppender());
            break;

        case SOCKET:
            auditAppender.addAppender(socketAppender());
            break;

        case CONSOLE:
            auditAppender.addAppender(consoleAppender());
            break;

        case HTTP:
            auditAppender.addAppender(httpAppender());
            break;

        case NONE:
            auditAppender.addFilter(new DenyAllFilter());
            break;

        default:
            throw new AuditLoggingException("Unknown appender " + appender);
        }
    }

    auditAppender.setRewritePolicy(new Log4j1EnricherPolicy());

    final Logger logger = Logger.getLogger(AuditConfiguration.ROOT_LOGGER.getString());

    logger.addAppender(auditAppender);
    logger.setAdditivity(false);
}
 

开发者ID:Talend,
项目名称:daikon,
代码行数:48,
代码来源:Log4j1Configurer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)