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