org.apache.log4j.AppenderSkeleton Java Examples
The following examples show how to use
org.apache.log4j.AppenderSkeleton.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TwoPhaseCommitSinkFunctionTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * 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); }
Example #2
Source File: TwoPhaseCommitSinkFunctionTest.java From flink with Apache License 2.0 | 6 votes |
/** * 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); }
Example #3
Source File: LocalSystemOperations.java From ats-framework with Apache License 2.0 | 6 votes |
public void setAtsDbAppenderThreshold( Level threshold ) { Logger rootLogger = Logger.getRootLogger(); Enumeration<Appender> appenders = rootLogger.getAllAppenders(); while (appenders.hasMoreElements()) { Appender appender = appenders.nextElement(); if (appender != null) { if (appender.getClass().getName().equals("com.axway.ats.log.appenders.ActiveDbAppender")) { ((AppenderSkeleton) appender).setThreshold(threshold); } if (appender.getClass().getName().equals("com.axway.ats.log.appenders.PassiveDbAppender")) { String callerId = ThreadsPerCaller.getCaller(); String passiveDbAppenderCaller = (String) ReflectionUtils.getFieldValue(appender, "caller", true); if (callerId != null && callerId.equals(passiveDbAppenderCaller)) { ((AppenderSkeleton) appender).setThreshold(threshold); } } } } }
Example #4
Source File: SchedulerStateRestLiveLogsTest.java From scheduling with GNU Affero General Public License v3.0 | 6 votes |
@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() { } }; } }; }
Example #5
Source File: LoggerUtilTest.java From attic-apex-core with Apache License 2.0 | 5 votes |
@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; } } }
Example #6
Source File: LoggerUtilTest.java From attic-apex-core with Apache License 2.0 | 5 votes |
@AfterClass public static void teardown() { for (Map.Entry<AppenderSkeleton, Priority> e : appenderLevelMap.entrySet()) { e.getKey().setThreshold(e.getValue()); } }
Example #7
Source File: ShimLoader.java From dremio-oss with Apache License 2.0 | 4 votes |
public static synchronized AppenderSkeleton getEventCounter() { if (eventCounter == null) { eventCounter = loadShims(EVENT_COUNTER_SHIM_CLASSES, AppenderSkeleton.class); } return eventCounter; }