Java 类org.apache.logging.log4j.status.StatusLogger 实例源码

项目:elasticsearch_my    文件:ESTestCase.java   
protected static void checkStaticState() throws Exception {
    MockPageCacheRecycler.ensureAllPagesAreReleased();
    MockBigArrays.ensureAllArraysAreReleased();
    // field cache should NEVER get loaded.
    String[] entries = UninvertingReader.getUninvertedStats();
    assertEquals("fieldcache must never be used, got=" + Arrays.toString(entries), 0, entries.length);

    // ensure no one changed the status logger level on us
    assertThat(StatusLogger.getLogger().getLevel(), equalTo(Level.WARN));
    synchronized (statusData) {
        try {
            // ensure that there are no status logger messages which would indicate a problem with our Log4j usage; we map the
            // StatusData instances to Strings as otherwise their toString output is useless
            assertThat(
                statusData.stream().map(status -> status.getMessage().getFormattedMessage()).collect(Collectors.toList()),
                empty());
        } finally {
            // we clear the list so that status data from other tests do not interfere with tests within the same JVM
            statusData.clear();
        }
    }
}
项目:bayou    文件:FloodGageMain.java   
public static void main(String[] args) throws Exception
{
    // some of the libs we depend on hard coded Log4J into the source. So disable their logging
    // to prevent warnings from being printed to the console
    StatusLogger.getLogger().setLevel(Level.OFF);

    if(args.length != 1)
    {
        System.out.println("Usage: java -cp [trails.jar]:[floodgage.jar] [bayou-hostname]");
        return;
    }

    String bayouHostname = args[0];
    SynthesizerBayou_1_1_0 synthesizer = new SynthesizerBayou_1_1_0(bayouHostname, 8080);

    try
    {
        new FloodGage().run(synthesizer, new ViewConsole());
    }
    finally
    {
        System.out.println(""); // so that visually the command prompt on exit is not cluttered by our output
    }
}
项目:monarch    文件:GeodeVerboseLogMarkerIntegrationTest.java   
@After
public void tearDown() throws Exception {
  Configurator.shutdown();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  if (this.beforeConfigFileProp != null) {
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
        this.beforeConfigFileProp);
  }
  StatusLogger.getLogger().setLevel(this.beforeLevel);

  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isTrue();

  BasicAppender.clearInstance();

  assertThat(this.systemErrRule.getLog()).isEmpty();
}
项目:monarch    文件:CustomConfigWithLogServiceIntegrationTest.java   
@Before
public void setUp() throws Exception {
  Configurator.shutdown();
  BasicAppender.clearInstance();

  this.beforeConfigFileProp =
      System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  this.beforeLevel = StatusLogger.getLogger().getLevel();

  this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());

  System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
      this.customConfigFile.getAbsolutePath());
  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isFalse();
}
项目:monarch    文件:CustomConfigWithLogServiceIntegrationTest.java   
@After
public void tearDown() throws Exception {
  Configurator.shutdown();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  if (this.beforeConfigFileProp != null) {
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
        this.beforeConfigFileProp);
  }
  StatusLogger.getLogger().setLevel(this.beforeLevel);

  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isTrue();

  BasicAppender.clearInstance();

  assertThat(this.systemErrRule.getLog()).isEmpty();
}
项目:monarch    文件:CustomConfigWithCacheIntegrationTest.java   
@Before
public void setUp() throws Exception {
  Configurator.shutdown();
  BasicAppender.clearInstance();

  this.beforeConfigFileProp =
      System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  this.beforeLevel = StatusLogger.getLogger().getLevel();

  this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());

  System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
      this.customConfigFile.getAbsolutePath());

  Properties gemfireProperties = new Properties();
  gemfireProperties.put(LOCATORS, "");
  gemfireProperties.put(MCAST_PORT, "0");
  gemfireProperties.put(LOG_LEVEL, "info");
  this.cache = new CacheFactory(gemfireProperties).create();
}
项目:monarch    文件:CustomConfigWithCacheIntegrationTest.java   
@After
public void tearDown() throws Exception {
  if (this.cache != null) {
    this.cache.getDistributedSystem().disconnect();
  }

  Configurator.shutdown();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  if (this.beforeConfigFileProp != null) {
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
        this.beforeConfigFileProp);
  }
  StatusLogger.getLogger().setLevel(this.beforeLevel);

  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isTrue();

  BasicAppender.clearInstance();

  assertThat(this.systemErrRule.getLog()).isEmpty();
}
项目:serverwiz    文件:TargetWizardController.java   
public void init() {
    try {
        String libraryLocation = ServerWizard2.GIT_LOCATION + File.separator + this.LIBRARY_NAME;
        File chk = new File(libraryLocation);
        if (!chk.exists()) {
            ServerWizard2.LOGGER.info("XML library does not exist so cloning: "+libraryLocation);
            StatusLogger.getLogger().setLevel(Level.FATAL);
            GithubRepository git = new GithubRepository(ServerWizard2.DEFAULT_REMOTE_URL, ServerWizard2.GIT_LOCATION, false);
            git.cloneRepository();
        }
        model.loadLibrary(libraryLocation);
        this.initModel();
    } catch (Exception e) {
        ServerWizard2.LOGGER.severe(e.toString());
        MessageDialog.openError(null, "Error", e.toString());
        e.printStackTrace();
        System.exit(4);
    }
}
项目:log4j2    文件:Charsets.java   
/**
 * Returns a Charset, if possible the Charset for the specified {@code charsetName}, otherwise (if the specified
 * {@code charsetName} is {@code null} or not supported) this method returns the platform default Charset.
 *
 * @param charsetName
 *            name of the preferred charset or {@code null}
 * @param defaultCharset
 *            returned if {@code charsetName} is null or is not supported.
 * @return a Charset, never null.
 */
public static Charset getSupportedCharset(final String charsetName, final Charset defaultCharset) {
    Charset charset = null;
    if (charsetName != null) {
        if (Charset.isSupported(charsetName)) {
            charset = Charset.forName(charsetName);
        }
    }
    if (charset == null) {
        charset = defaultCharset;
        if (charsetName != null) {
            StatusLogger.getLogger().error(
                    "Charset " + charsetName + " is not supported for layout, using " + charset.displayName());
        }
    }
    return charset;
}
项目:logging-log4j2    文件:ReliabilityStrategyFactory.java   
/**
 * Returns a new {@code ReliabilityStrategy} instance based on the value of system property
 * {@code log4j.ReliabilityStrategy}. If not value was specified this method returns a new
 * {@code AwaitUnconditionallyReliabilityStrategy}.
 * <p>
 * Valid values for this system property are {@code "AwaitUnconditionally"} (use
 * {@code AwaitUnconditionallyReliabilityStrategy}), {@code "Locking"} (use {@code LockingReliabilityStrategy}) and
 * {@code "AwaitCompletion"} (use the default {@code AwaitCompletionReliabilityStrategy}).
 * <p>
 * Users may also use this system property to specify the fully qualified class name of a class that implements the
 * {@code ReliabilityStrategy} and has a constructor that accepts a single {@code LoggerConfig} argument.
 * 
 * @param loggerConfig the LoggerConfig the resulting {@code ReliabilityStrategy} is associated with
 * @return a ReliabilityStrategy that helps the specified LoggerConfig to log events reliably during or after a
 *         configuration change
 */
public static ReliabilityStrategy getReliabilityStrategy(final LoggerConfig loggerConfig) {

    final String strategy = PropertiesUtil.getProperties().getStringProperty("log4j.ReliabilityStrategy",
            "AwaitCompletion");
    if ("AwaitCompletion".equals(strategy)) {
        return new AwaitCompletionReliabilityStrategy(loggerConfig);
    }
    if ("AwaitUnconditionally".equals(strategy)) {
        return new AwaitUnconditionallyReliabilityStrategy(loggerConfig);
    }
    if ("Locking".equals(strategy)) {
        return new LockingReliabilityStrategy(loggerConfig);
    }
    try {
        final Class<? extends ReliabilityStrategy> cls = LoaderUtil.loadClass(strategy).asSubclass(
            ReliabilityStrategy.class);
        return cls.getConstructor(LoggerConfig.class).newInstance(loggerConfig);
    } catch (final Exception dynamicFailed) {
        StatusLogger.getLogger().warn(
                "Could not create ReliabilityStrategy for '{}', using default AwaitCompletionReliabilityStrategy: {}", strategy, dynamicFailed);
        return new AwaitCompletionReliabilityStrategy(loggerConfig);
    }
}
项目:logging-log4j2    文件:GelfLayout.java   
private byte[] compress(final byte[] bytes) {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(compressionThreshold / 8);
        try (final DeflaterOutputStream stream = compressionType.createDeflaterOutputStream(baos)) {
            if (stream == null) {
                return bytes;
            }
            stream.write(bytes);
            stream.finish();
        }
        return baos.toByteArray();
    } catch (final IOException e) {
        StatusLogger.getLogger().error(e);
        return bytes;
    }
}
项目:log4j2    文件:AbstractJdbcAppenderTest.java   
protected void setUp(final String tableName, final String configFileName) throws SQLException {
    this.connection = this.newConnection();
    final Statement statement = this.connection.createStatement();
    try {
        statement.executeUpdate(this.toCreateTableSqlString(tableName));
    } finally {
        statement.close();
    }
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
            "org/apache/logging/log4j/core/appender/db/jdbc/" + configFileName);
    final LoggerContext context = (LoggerContext) LogManager.getContext(false);
    if (context.getConfiguration() instanceof DefaultConfiguration) {
        context.reconfigure();
    }
    StatusLogger.getLogger().reset();
}
项目:logging-log4j2    文件:OnStartupTriggeringPolicy.java   
/**
 * Returns the result of {@code ManagementFactory.getRuntimeMXBean().getStartTime()},
 * or the current system time if JMX is not available.
 */
private static long initStartTime() {
    // LOG4J2-379:
    // We'd like to call ManagementFactory.getRuntimeMXBean().getStartTime(),
    // but Google App Engine throws a java.lang.NoClassDefFoundError
    // "java.lang.management.ManagementFactory is a restricted class".
    // The reflection is necessary because without it, Google App Engine
    // will refuse to initialize this class.
    try {
        final Class<?> factoryClass = Loader.loadSystemClass("java.lang.management.ManagementFactory");
        final Method getRuntimeMXBean = factoryClass.getMethod("getRuntimeMXBean");
        final Object runtimeMXBean = getRuntimeMXBean.invoke(null);

        final Class<?> runtimeMXBeanClass = Loader.loadSystemClass("java.lang.management.RuntimeMXBean");
        final Method getStartTime = runtimeMXBeanClass.getMethod("getStartTime");
        final Long result = (Long) getStartTime.invoke(runtimeMXBean);

        return result;
    } catch (final Throwable t) {
        StatusLogger.getLogger().error("Unable to call ManagementFactory.getRuntimeMXBean().getStartTime(), "
                + "using system time for OnStartupTriggeringPolicy", t);
        // We have little option but to declare "now" as the beginning of time.
        return System.currentTimeMillis();
    }
}
项目:logging-log4j2    文件:JdbcAppenderBenchmark.java   
@Setup
public void setup() throws Exception {
    connectionHSQLDB = getConnectionHSQLDB();
    connectionH2 = getConnectionH2();
    createTable(connectionHSQLDB, toCreateTableSqlStringHQLDB("fmLogEntry"));
    createTable(connectionH2, toCreateTableSqlStringH2("fmLogEntry"));

    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, "log4j2-jdbc-appender.xml");
    final LoggerContext context = LoggerContext.getContext(false);
    if (context.getConfiguration() instanceof DefaultConfiguration) {
        context.reconfigure();
    }
    StatusLogger.getLogger().reset();
    loggerH2 = LogManager.getLogger("H2Logger");
    loggerHSQLDB = LogManager.getLogger("HSQLDBLogger");
}
项目:logging-log4j2    文件:AbstractLogger.java   
/**
 * Checks that the message factory a logger was created with is the same as the given messageFactory. If they are
 * different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates to the default
 * MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}.
 *
 * @param logger The logger to check
 * @param messageFactory The message factory to check.
 */
public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) {
    final String name = logger.getName();
    final MessageFactory loggerMessageFactory = logger.getMessageFactory();
    if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) {
        StatusLogger.getLogger().warn(
                "The Logger {} was created with the message factory {} and is now requested with the "
                        + "message factory {}, which may create log events with unexpected formatting.", name,
                loggerMessageFactory, messageFactory);
    } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) {
        StatusLogger
                .getLogger()
                .warn("The Logger {} was created with the message factory {} and is now requested with a null "
                        + "message factory (defaults to {}), which may create log events with unexpected "
                        + "formatting.",
                        name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());
    }
}
项目:logging-log4j2    文件:CsvLogEventLayout.java   
@Override
public String toSerializable(final LogEvent event) {
    final StringBuilder buffer = getStringBuilder();
    final CSVFormat format = getFormat();
    try {
        format.print(event.getNanoTime(), buffer, true);
        format.print(event.getTimeMillis(), buffer, false);
        format.print(event.getLevel(), buffer, false);
        format.print(event.getThreadId(), buffer, false);
        format.print(event.getThreadName(), buffer, false);
        format.print(event.getThreadPriority(), buffer, false);
        format.print(event.getMessage().getFormattedMessage(), buffer, false);
        format.print(event.getLoggerFqcn(), buffer, false);
        format.print(event.getLoggerName(), buffer, false);
        format.print(event.getMarker(), buffer, false);
        format.print(event.getThrownProxy(), buffer, false);
        format.print(event.getSource(), buffer, false);
        format.print(event.getContextData(), buffer, false);
        format.print(event.getContextStack(), buffer, false);
        format.println(buffer);
        return buffer.toString();
    } catch (final IOException e) {
        StatusLogger.getLogger().error(event.toString(), e);
        return format.getCommentMarker() + " " + e;
    }
}
项目:logging-log4j2    文件:ThrowableProxy.java   
private ThrowableProxy[] toSuppressedProxies(final Throwable thrown, Set<Throwable> suppressedVisited) {
    try {
        final Throwable[] suppressed = thrown.getSuppressed();
        if (suppressed == null) {
            return EMPTY_THROWABLE_PROXY_ARRAY;
        }
        final List<ThrowableProxy> proxies = new ArrayList<>(suppressed.length);
        if (suppressedVisited == null) {
            suppressedVisited = new HashSet<>(proxies.size());
        }
        for (int i = 0; i < suppressed.length; i++) {
            final Throwable candidate = suppressed[i];
            if (!suppressedVisited.contains(candidate)) {
                suppressedVisited.add(candidate);
                proxies.add(new ThrowableProxy(candidate, suppressedVisited));
            }
        }
        return proxies.toArray(new ThrowableProxy[proxies.size()]);
    } catch (final Exception e) {
        StatusLogger.getLogger().error(e);
    }
    return null;
}
项目:logging-log4j2    文件:JmsManager.java   
private boolean closeConnection() {
    if (connection == null) {
        return true;
    }
    final Connection temp = connection;
    connection = null;
    try {
        temp.close();
        return true;
    } catch (final JMSException e) {
        StatusLogger.getLogger().debug(
                "Caught exception closing JMS Connection: {} ({}); continuing JMS manager shutdown",
                e.getLocalizedMessage(), temp, e);
        return false;
    }
}
项目:logging-log4j2    文件:JmsManager.java   
private boolean closeMessageProducer() {
    if (messageProducer == null) {
        return true;
    }
    final MessageProducer temp = messageProducer;
    messageProducer = null;
    try {
        temp.close();
        return true;
    } catch (final JMSException e) {
        StatusLogger.getLogger().debug(
                "Caught exception closing JMS MessageProducer: {} ({}); continuing JMS manager shutdown",
                e.getLocalizedMessage(), temp, e);
        return false;
    }
}
项目:logging-log4j2    文件:AbstractJpaAppenderTest.java   
public void tearDown() throws SQLException {
    final LoggerContext context = LoggerContext.getContext(false);
    try {
        String appenderName = "databaseAppender";
        final Appender appender = context.getConfiguration().getAppender(appenderName);
        assertNotNull("The appender '" + appenderName + "' should not be null.", appender);
        assertTrue("The appender should be a JpaAppender.", appender instanceof JpaAppender);
        ((JpaAppender) appender).getManager().close();
    } finally {
        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        PropertiesUtil.getProperties().reload();
        context.reconfigure();
        StatusLogger.getLogger().reset();

        try (Statement statement = this.connection.createStatement();) {
            statement.execute("SHUTDOWN");
        }

        this.connection.close();
    }
}
项目:logging-log4j2    文件:MessagePatternConverter.java   
private TextRenderer loadMessageRenderer(final String[] options) {
    if (options != null) {
        for (final String option : options) {
            switch (option.toUpperCase(Locale.ROOT)) {
            case "ANSI":
                if (Loader.isJansiAvailable()) {
                    return new JAnsiTextRenderer(options, JAnsiTextRenderer.DefaultMessageStyleMap);
                }
                StatusLogger.getLogger()
                        .warn("You requested ANSI message rendering but JANSI is not on the classpath.");
                return null;
            case "HTML":
                return new HtmlTextRenderer(options);
            }
        }
    }
    return null;
}
项目:monarch    文件:LogService.java   
@Override
@SuppressWarnings("synthetic-access")
public void propertyChange(final PropertyChangeEvent evt) {
  StatusLogger.getLogger().debug(
      "LogService responding to a property change event. Property name is {}.",
      evt.getPropertyName());

  if (evt.getPropertyName().equals(LoggerContext.PROPERTY_CONFIG)) {
    configureFastLoggerDelegating();
  }
}
项目:monarch    文件:GeodeVerboseLogMarkerIntegrationTest.java   
@Before
public void setUp() throws Exception {
  Configurator.shutdown();
  BasicAppender.clearInstance();

  this.beforeConfigFileProp =
      System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  this.beforeLevel = StatusLogger.getLogger().getLevel();

  this.configFileGemfireVerboseAccept = createConfigFile(FILE_NAME_GEMFIRE_VERBOSE_ACCEPT);
  this.configFileGemfireVerboseDeny = createConfigFile(FILE_NAME_GEMFIRE_VERBOSE_DENY);
  this.configFileGeodeVerboseAccept = createConfigFile(FILE_NAME_GEODE_VERBOSE_ACCEPT);
  this.configFileGeodeVerboseDeny = createConfigFile(FILE_NAME_GEODE_VERBOSE_DENY);
}
项目:monarch    文件:LogServiceIntegrationJUnitTest.java   
@Override
protected void before() {
  beforeConfigFileProp = System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  beforeLevel = StatusLogger.getLogger().getLevel();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  StatusLogger.getLogger().setLevel(Level.OFF);

  Configurator.shutdown();
}
项目:monarch    文件:LogServiceIntegrationJUnitTest.java   
@Override
protected void after() {
  Configurator.shutdown();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  if (beforeConfigFileProp != null) {
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, beforeConfigFileProp);
  }
  StatusLogger.getLogger().setLevel(beforeLevel);

  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isTrue();
}
项目:logging-log4j2    文件:AwaitUnconditionallyReliabilityStrategy.java   
@Override
public void beforeStopConfiguration(final Configuration configuration) {
    // only sleep once per configuration stop
    if (loggerConfig == configuration.getRootLogger()) {
        try {
            Thread.sleep(SLEEP_MILLIS);
        } catch (final InterruptedException e) {
            StatusLogger.getLogger().warn("Sleep before stop configuration was interrupted.");
        }
    }
}
项目:log4j2    文件:PropertiesUtil.java   
/**
 * Return the system properties or an empty Properties object if an error occurs.
 * @return The system properties.
 */
public static Properties getSystemProperties() {
    try {
        return new Properties(System.getProperties());
    } catch (final SecurityException ex) {
        StatusLogger.getLogger().error("Unable to access system properties.");
        // Sandboxed - can't read System Properties
        return new Properties();
    }
}
项目:log4j2    文件:CatchingTagTest.java   
@AfterClass
public static void cleanUpClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext context = (LoggerContext) LogManager.getContext(false);
    context.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:log4j2    文件:LoggingMessageTagSupportTest.java   
@AfterClass
public static void cleanUpClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext context = (LoggerContext) LogManager.getContext(false);
    context.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:log4j2    文件:IfEnabledTagTest.java   
@AfterClass
public static void cleanUpClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext context = (LoggerContext) LogManager.getContext(false);
    context.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:log4j2    文件:ExitTagTest.java   
@AfterClass
public static void cleanUpClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext context = (LoggerContext) LogManager.getContext(false);
    context.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:log4j2    文件:LoggerTest.java   
@AfterClass
public static void cleanupClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
    ctx.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:logging-log4j2    文件:AdvertiserTest.java   
@AfterClass
public static void cleanupClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
    StatusLogger.getLogger().reset();
    final File file = new File(STATUS_LOG);
    file.delete();
}
项目:log4j2    文件:Server.java   
private static void unregisterAllMatching(final String search, final MBeanServer mbs) {
    try {
        final ObjectName pattern = new ObjectName(search);
        final Set<ObjectName> found = mbs.queryNames(pattern, null);
        for (final ObjectName objectName : found) {
            mbs.unregisterMBean(objectName);
        }
    } catch (final Exception ex) {
        StatusLogger.getLogger()
                .error("Could not unregister " + search, ex);
    }
}
项目:log4j2    文件:StatusLoggerAdmin.java   
/**
 * Constructs a new {@code StatusLoggerAdmin} with the {@code Executor} to
 * be used for sending {@code Notification}s asynchronously to listeners.
 *
 * @param executor used to send notifications asynchronously
 */
public StatusLoggerAdmin(final Executor executor) {
    super(executor, createNotificationInfo());
    try {
        objectName = new ObjectName(NAME);
    } catch (final Exception e) {
        throw new IllegalStateException(e);
    }
    StatusLogger.getLogger().registerListener(this);
}
项目:log4j2    文件:StyleConverterTest.java   
@AfterClass
public static void cleanupClass() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    ctx.reconfigure();
    StatusLogger.getLogger().reset();
    ThreadContext.clear();
}
项目:log4j2    文件:ThreadedTest.java   
@AfterClass
public static void cleanupClass() {
    deleteDir();
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext ctx = (LoggerContext) LogManager.getContext();
    ctx.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:log4j2    文件:XMLConfigurationTest.java   
@After
public void tearDown() {
    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    final LoggerContext ctx = (LoggerContext) LogManager.getContext();
    ctx.reconfigure();
    StatusLogger.getLogger().reset();
}
项目:logging-log4j2    文件:LoggersPluginTest.java   
@Test
public void testEmptyAttribute() throws Exception {
    final Logger logger = LogManager.getLogger();
    logger.info("Test");
    final StatusData data = StatusLogger.getLogger().getStatusData().get(0);
    //System.out.println(data.getFormattedStatus());

    assertEquals(Level.ERROR, data.getLevel());
    assertTrue(data.getMessage().getFormattedMessage().contains("multiple root loggers"));
}