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


Java AppenderSkeleton类代码示例

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


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

示例1: EngineLogView

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
public EngineLogView() {
	labelProvider = new EngineLogViewLabelProvider();
	appender = new AppenderSkeleton() {

		@Override
		protected void append(LoggingEvent arg0) {
			synchronized (this) {
				this.notifyAll();
			}
		}

		public void close() {
		}

		public boolean requiresLayout() {
			return false;
		}
	};
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:20,代码来源:EngineLogView.java

示例2: setupLogger

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
/**
 * Setup {@link org.apache.log4j.Logger}, the default logger implementation for tests,
 * to append {@link LoggingEvent}s to {@link #loggingEvents} so that we can assert if
 * the right messages were logged.
 *
 * @see #testLogTimeoutAlmostReachedWarningDuringCommit
 * @see #testLogTimeoutAlmostReachedWarningDuringRecovery
 */
private void setupLogger() {
	Logger.getRootLogger().removeAllAppenders();
	logger = Logger.getLogger(TwoPhaseCommitSinkFunction.class);
	testAppender = new AppenderSkeleton() {
		@Override
		protected void append(LoggingEvent event) {
			loggingEvents.add(event);
		}

		@Override
		public void close() {

		}

		@Override
		public boolean requiresLayout() {
			return false;
		}
	};
	logger.addAppender(testAppender);
	logger.setLevel(Level.WARN);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:31,代码来源:TwoPhaseCommitSinkFunctionTest.java

示例3: LogVerifier

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
public LogVerifier() {
    this.appender = new AppenderSkeleton() {
        @Override
        public void close() {
        }

        @Override
        public boolean requiresLayout() {
            return false;
        }

        @Override
        protected void append(LoggingEvent event) {
            LogVerifier.this.append(event);
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:LogVerifier.java

示例4: createAppenderProvider

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@Override
public AppenderProvider createAppenderProvider(URI serverURI) throws LogForwardingException {
    return new AppenderProvider() {
        @Override
        public Appender getAppender() throws LogForwardingException {
            return new AppenderSkeleton() {
                @Override
                protected void append(LoggingEvent event) {
                    eventProcessor.processEvent(event);
                }

                @Override
                public boolean requiresLayout() {
                    return false;
                }

                @Override
                public void close() {
                }
            };
        }
    };
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:24,代码来源:SchedulerStateRestLiveLogsTest.java

示例5: setUp

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@Before
public void setUp()
	throws SQLException, IOException, InterruptedException
{
	Appender a = Logger.getRootLogger().getAppender("STDERR");
	if (a instanceof AppenderSkeleton) {
		((AppenderSkeleton)a).setThreshold(Level.DEBUG);
	}
	dbManager.cleanup();
	servers.cleanup();
	servers.start(serverArgs);
	servers.waitUntilActive();
	servers.createDatabaseA();
	tr.startup();
	log.info("######################################################################");
	log.info("######################################################################");
	log.info("setup done");
}
 
开发者ID:shesse,项目名称:h2ha,代码行数:19,代码来源:DbLargeSyncTests.java

示例6: setUp

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@Before
public void setUp()
	throws SQLException, IOException, InterruptedException
{
	log.info("######################################################################");
	log.info("######################################################################");
	log.info("setting up");
	Appender a = Logger.getRootLogger().getAppender("STDERR");
	if (a instanceof AppenderSkeleton) {
		((AppenderSkeleton)a).setThreshold(Level.DEBUG);
	}
	log.info("######################################################################");
	log.info("######################################################################");
	log.info("setting up");
	dbManager.cleanup();
	tr.startup();
	log.info("######################################################################");
	log.info("######################################################################");
	log.info("setup done");
}
 
开发者ID:shesse,项目名称:h2ha,代码行数:21,代码来源:PermanentLoadGenerator.java

示例7: setUp

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@Before
public void setUp()
	throws SQLException, IOException, InterruptedException
{
	Appender a = Logger.getRootLogger().getAppender("STDERR");
	if (a instanceof AppenderSkeleton) {
		((AppenderSkeleton)a).setThreshold(Level.DEBUG);
	}
	dbManager.cleanup();
	servers.cleanup();
	servers.start();
	servers.waitUntilActive();
	servers.createDatabaseA();
	tr.startup();
	log.info("######################################################################");
	log.info("######################################################################");
	log.info("setup done");
}
 
开发者ID:shesse,项目名称:h2ha,代码行数:19,代码来源:FailoverTestsPageStore.java

示例8: setUp

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
/**
 * Sets up.
 *
 * @throws Exception the exception
 */
@Before
public void setUp() throws Exception {

    testling = createTestling(environment, enableServiceBrokerFake);

    testAppender = new AppenderSkeleton() {
        @Override
        protected void append(final LoggingEvent loggingEvent) {
            System.out.println("**** APPEND ****");
            logMessage = loggingEvent.getMessage().toString();
        }

        @Override
        public void close() {

        }

        @Override
        public boolean requiresLayout() {
            return false;
        }
    };

    Logger.getLogger(testling.getClass()).setAdditivity(true);
    Logger.getLogger(testling.getClass()).addAppender(testAppender);
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:32,代码来源:MockingBaseContextTest.java

示例9: initLogger

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
private static void initLogger(String filename) {
	final String PATTERN = "[%d{yyyy-MM-dd HH:mm:ss}] [%-5p] [%c{1}] %m%n";
	
	// Stores whether an error has occured
	AppenderSkeleton errorFlagAppender = new ErrorFlagAppender();
	errorFlagAppender.setThreshold(Level.ERROR);
	errorFlagAppender.activateOptions();
	org.apache.log4j.Logger.getRootLogger().addAppender(errorFlagAppender);

	ConsoleAppender consoleAppender = new ConsoleAppender(); 
	consoleAppender.setEncoding("UTF-8");
	consoleAppender.setLayout(new PatternLayout(PATTERN)); 
	consoleAppender.setThreshold(LOG_LEVEL);
	consoleAppender.activateOptions();		
	AsyncAppender asyncConsoleAppender = new AsyncAppender();
	asyncConsoleAppender.addAppender(consoleAppender);
	asyncConsoleAppender.setBufferSize(1024);
	asyncConsoleAppender.activateOptions();
	org.apache.log4j.Logger.getRootLogger().addAppender(asyncConsoleAppender);
	
	FileAppender fileAppender = new FileAppender();
	fileAppender.setEncoding("UTF-8");
	fileAppender.setFile(filename);
	fileAppender.setLayout(new PatternLayout(PATTERN));
	fileAppender.setThreshold(LOG_LEVEL);
	fileAppender.setAppend(false);
	fileAppender.activateOptions();
	AsyncAppender asyncFileAppender = new AsyncAppender();
	asyncFileAppender.addAppender(fileAppender);
	asyncFileAppender.setBufferSize(1024);
	asyncFileAppender.activateOptions();
	org.apache.log4j.Logger.getRootLogger().addAppender(asyncFileAppender);
	
}
 
开发者ID:heindorf,项目名称:cikm16-wdvd-feature-extraction,代码行数:35,代码来源:FeatureExtractor.java

示例10: setup

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
  logger.debug("Logger repository before LoggerUtil.changeLoggersLevel() {}", LogManager.getLoggerRepository());
  LoggerUtil.changeLoggersLevel(Maps.<String, String>newHashMap());
  logger.debug("Logger repository after LoggerUtil.changeLoggersLevel() {}", LogManager.getLoggerRepository());
  log4jLogger.setLevel(Level.TRACE);
  Category category = log4jLogger;
  while (category != null) {
    Enumeration appenders = category.getAllAppenders();
    while (appenders.hasMoreElements()) {
      Object o = appenders.nextElement();
      if (o instanceof AppenderSkeleton) {
        AppenderSkeleton appender = (AppenderSkeleton)o;
        if (!appenderLevelMap.containsKey(appender)) {
          appenderLevelMap.put(appender, appender.getThreshold());
          appender.setThreshold(Level.INFO);
        }
      }
    }
    if (category.getAdditivity()) {
      category = category.getParent();
    } else {
      category = null;
    }
  }
}
 
开发者ID:apache,项目名称:apex-core,代码行数:28,代码来源:LoggerUtilTest.java

示例11: teardown

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@AfterClass
public static void teardown()
{
  for (Map.Entry<AppenderSkeleton, Priority> e : appenderLevelMap.entrySet()) {
    e.getKey().setThreshold(e.getValue());
  }
}
 
开发者ID:apache,项目名称:apex-core,代码行数:8,代码来源:LoggerUtilTest.java

示例12: addErrorAppender

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
/**
 * Add a usage appender for the root logger. This appender will write ERROR and FATAL log messages 
 * to the usage database.
 */
public static void addErrorAppender() {
	usageAppender = new AppenderSkeleton() {
		boolean logAll = Boolean.getBoolean("logAll");
		PatternLayout patternLayout = new PatternLayout("[%t] %c - %m");
		
		@Override
		protected void append(LoggingEvent event) {
			
			if (logAll || event.getLevel().equals(Level.ERROR) ||
				event.getLevel().equals(Level.FATAL)) {
				ThrowableInformation info = event.getThrowableInformation();
				StringBuffer buf = new StringBuffer();
				if (info == null) buf.append("No stack trace");
				else {
					for (String line : info.getThrowableStrRep())
						buf.append(line).append('\n');
				}

				EnsembleUsageLogger.logUsage(
						event.getLevel().toString(),
						patternLayout.format(event) +" -- "+ buf.toString());
			}
		}
		@Override
		public void close() { /* do nothing */ }
		@Override
		public boolean requiresLayout() { return false;	}
		
	};
	
	Logger.getRootLogger().addAppender(usageAppender);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:37,代码来源:EnsembleUsageLogger.java

示例13: setUp

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
@Before
public void setUp()
	throws SQLException, IOException, InterruptedException
{
	Appender a = Logger.getRootLogger().getAppender("STDERR");
	if (a instanceof AppenderSkeleton) {
		((AppenderSkeleton) a).setThreshold(Level.DEBUG);
	}
	dbManager.cleanup();
	servers.cleanupA();
	servers.startA();
	servers.waitUntilAIsActive();
	servers.createDatabaseA();
	tr.startup();
}
 
开发者ID:shesse,项目名称:h2ha,代码行数:16,代码来源:SingleServerTests.java

示例14: testBroadcastMessage

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
public void testBroadcastMessage() throws IOException {
    success = false;
    Logger jcl = Logger.getLogger(JarCacheUpdateHandler.class);
    String uri = "jar://mytest/testjar1.jar";
    sb = new StringBuilder();
    final BasePipelineIntTest monitor = this;

    Appender app = new AppenderSkeleton() {
        @Override
        public void close() {
        }

        @Override
        public boolean requiresLayout() {
            return false;
        }

        @Override
        protected void append(LoggingEvent event) {
            sb.append(event.getMessage());
            success = true;
            synchronized (this) {
                this.notify();
            }
        }
    };
    jcl.addAppender(app);

    RapturePipelineTask task = new RapturePipelineTask();
    MimeJarCacheUpdate mime = new MimeJarCacheUpdate();
    mime.setJarUri(new RaptureURI(uri, Scheme.JAR));
    mime.setDeletion(true);
    task.setContentType(MimeJarCacheUpdate.getMimeType());
    task.addMimeObject(mime);

    synchronized (app) {
        Kernel.getPipeline().broadcastMessageToAll(context, task);
        try {
            app.wait(5000);
        } catch (Exception e) {
        }
    }
    assertTrue("log appender was not called after 5s", success);
    Assert.assertEquals("Updating jar cache for jar uri [jar://mytest/testjar1.jar]", sb.toString());
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:46,代码来源:BasePipelineIntTest.java

示例15: testBroadcastMessage

import org.apache.log4j.AppenderSkeleton; //导入依赖的package包/类
public void testBroadcastMessage() throws IOException {
    success = false;
    Logger jcl = Logger.getLogger(JarCacheUpdateHandler.class);
    String uri = "jar://mytest/testjar1.jar";
    sb = new StringBuilder();
    final BasePipeline2IntTest monitor = this;

    Appender app = new AppenderSkeleton() {
        @Override
        public void close() {
        }

        @Override
        public boolean requiresLayout() {
            return false;
        }

        @Override
        protected void append(LoggingEvent event) {
            sb.append(event.getMessage());
            success = true;
            synchronized (this) {
                this.notify();
            }
        }
    };
    jcl.addAppender(app);

    MimeJarCacheUpdate mime = new MimeJarCacheUpdate();
    mime.setJarUri(new RaptureURI(uri, Scheme.JAR));
    mime.setDeletion(true);

    synchronized (app) {
        TaskSubmitter.submitBroadcastToAll(context, mime, MimeJarCacheUpdate.getMimeType(), null);
        // Kernel.getPipeline2().getTrusted().broadcastMessageToAll(context, task);
        try {
            app.wait(20000);
        } catch (Exception e) {
        }
    }
    assertTrue("log appender was not called after 20s", success);
    Assert.assertTrue(sb.toString().startsWith("Updating jar cache for jar uri [jar://mytest/testjar1.jar]"));
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:44,代码来源:BasePipeline2IntTest.java


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