Package org.apache.logging.log4j.core

Examples of org.apache.logging.log4j.core.Appender


        Node routeNode = route.getNode();
        for (Node node : routeNode.getChildren()) {
            if (node.getType().getElementName().equals("appender")) {
                config.createConfiguration(node, event);
                if (node.getObject() instanceof Appender) {
                    Appender app = (Appender) node.getObject();
                    app.start();
                    return (Appender) node.getObject();
                }
                LOGGER.error("Unable to create Appender of type " + node.getName());
                return null;
            }
View Full Code Here


            {
                contextConfigurer.configure(context);
                ArgumentCaptor<ConsoleAppender> appenderCaptor = ArgumentCaptor.forClass(ConsoleAppender.class);
                verify(context.getConfiguration()).addAppender(appenderCaptor.capture());

                Appender forcedConsoleAppender = appenderCaptor.getValue();

                assertThat(forcedConsoleAppender, notNullValue());
                assertThat(forcedConsoleAppender.getName(), equalTo("Forced-Console"));
                assertThat(forcedConsoleAppender.isStarted(), is(true));

                LoggerConfig rootLogger = ((AbstractConfiguration) context.getConfiguration()).getRootLogger();
                verify(rootLogger).addAppender(forcedConsoleAppender, Level.INFO, null);
            }
        });
View Full Code Here

    private static void registerAppenders(final LoggerContext ctx, final MBeanServer mbs, final Executor executor)
            throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {

        final Map<String, Appender> map = ctx.getConfiguration().getAppenders();
        for (final String name : map.keySet()) {
            final Appender appender = map.get(name);

            if (appender instanceof AsyncAppender) {
                AsyncAppender async = ((AsyncAppender) appender);
                final AsyncAppenderAdmin mbean = new AsyncAppenderAdmin(ctx.getName(), async);
                register(mbs, mbean, mbean.getObjectName());
View Full Code Here

    {
        super.doSetUpBeforeMuleContextCreation();

        LoggerContext context = (LoggerContext) LogManager.getContext(false);
        LoggerConfig rootLogger = ((AbstractConfiguration) context.getConfiguration()).getRootLogger();
        Appender appender = new TestAppender("testAppender", null, null);
        context.getConfiguration().addAppender(appender);
        rootLogger.addAppender(appender, Level.WARN, null);

        context.updateLoggers();
    }
View Full Code Here

        doAddAppender(context, appender);
    }

    private void forceConsoleAppender(MuleLoggerContext context)
    {
        Appender appender = ConsoleAppender.createAppender(createLayout(context.getConfiguration()), null, null, "Forced-Console", null, null);
        doAddAppender(context, appender);
    }
View Full Code Here

        }

        for (final Map.Entry<String, LoggerConfig> entry : loggers.entrySet()) {
            final LoggerConfig l = entry.getValue();
            for (final AppenderRef ref : l.getAppenderRefs()) {
                final Appender app = appenders.get(ref.getRef());
                if (app != null) {
                    l.addAppender(app, ref.getLevel(), ref.getFilter());
                } else {
                    LOGGER.error("Unable to locate appender " + ref.getRef() + " for logger " + l.getName());
                }
View Full Code Here

    private void setToDefault() {
        setName(DefaultConfiguration.DEFAULT_NAME);
        final Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
            null, null, null);
        final Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false",
            "true");
        appender.start();
        addAppender(appender);
        final LoggerConfig root = getRootLogger();
        root.addAppender(appender, null, null);

        final String levelName = PropertiesUtil.getProperties().getStringProperty(DefaultConfiguration.DEFAULT_LEVEL);
View Full Code Here

     */
    public synchronized void removeAppender(final String name) {
        for (final LoggerConfig logger : loggers.values()) {
            logger.removeAppender(name);
        }
        final Appender app = appenders.remove(name);

        if (app != null) {
            app.stop();
        }
    }
View Full Code Here

    public DefaultConfiguration() {

        setName(DEFAULT_NAME);
        final Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
            null, null, null);
        final Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false",
            "true");
        appender.start();
        addAppender(appender);
        final LoggerConfig root = getRootLogger();
        root.addAppender(appender, null, null);

        final String levelName = PropertiesUtil.getProperties().getStringProperty(DEFAULT_LEVEL);
View Full Code Here

    public DefaultConfiguration() {

        setName(DEFAULT_NAME);
        Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
            null, null, null);
        Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "true");
        appender.start();
        addAppender(appender);
        LoggerConfig root = getRootLogger();
        root.addAppender(appender, null, null);

        String l = System.getProperty(DEFAULT_LEVEL);
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.core.Appender

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.