Examples of LogContext


Examples of org.jboss.logmanager.LogContext

            if (configFile != null) {
                result = true;
                // Get the module
                final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
                // Create the log context and load into the selector for the module and keep a strong reference
                final LogContext logContext;
                if (isLog4jConfiguration(configFile.getName())) {
                    logContext = LogContext.create(true);
                } else {
                    logContext = LogContext.create();
                }
View Full Code Here

Examples of org.jboss.logmanager.LogContext

            configStream = configFile.openStream();

            // Check the type of the configuration file
            if (isLog4jConfiguration(fileName)) {
                final ClassLoader current = SecurityActions.getThreadContextClassLoader();
                final LogContext old = LoggingExtension.THREAD_LOCAL_CONTEXT_SELECTOR.getAndSet(CONTEXT_LOCK, logContext);
                try {
                    SecurityActions.setThreadContextClassLoader(classLoader);
                    if (LOG4J_XML.equals(fileName) || JBOSS_LOG4J_XML.equals(fileName)) {
                        new DOMConfigurator().doConfigure(configStream, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
                    } else {
View Full Code Here

Examples of org.jboss.logmanager.LogContext

     * @param loggingProfile the logging profile to get or create the log context for
     *
     * @return the log context that was found or a new log context
     */
    public LogContext getOrCreate(final String loggingProfile) {
        LogContext result = profileContexts.get(loggingProfile);
        if (result == null) {
            result = LogContext.create();
            final LogContext current = profileContexts.putIfAbsent(loggingProfile, result);
            if (current != null) {
                result = current;
            }
        }
        return result;
View Full Code Here

Examples of org.jboss.logmanager.LogContext

        LogContext.getLogContext().getLogger(CommonAttributes.ROOT_LOGGER_NAME).attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, defaultContext);
    }

    @Override
    public StdioContext getStdioContext() {
        final LogContext logContext = LogContext.getLogContext();
        final Logger root = logContext.getLogger(CommonAttributes.ROOT_LOGGER_NAME);
        StdioContext stdioContext = root.getAttachment(STDIO_CONTEXT_ATTACHMENT_KEY);
        if (stdioContext == null) {
            stdioContext = StdioContext.create(
                    new NullInputStream(),
                    new LoggingOutputStream(logContext.getLogger("stdout"), Level.INFO),
                    new LoggingOutputStream(logContext.getLogger("stderr"), Level.ERROR)
            );
            final StdioContext appearing = root.attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, stdioContext);
            if (appearing != null) {
                stdioContext = appearing;
            }
View Full Code Here

Examples of org.jboss.logmanager.LogContext

            final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
            final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);

            // If this is a subdeployment and a log configuration was found on the parent, use that log context
            if (SubDeploymentMarker.isSubDeployment(root)) {
                final LogContext logContext = findParentLogContext(deploymentUnit);
                if (logContext != null) {
                    LoggingExtension.CONTEXT_SELECTOR.registerLogContext(module.getClassLoader(), logContext);
                    return;
                }
            }

            LoggingLogger.ROOT_LOGGER.trace("Scanning for logging configuration files.");
            final VirtualFile configFile = findConfigFile(root);
            if (configFile != null) {
                InputStream configStream = null;
                try {
                    LoggingLogger.ROOT_LOGGER.debugf("Found logging configuration file: %s", configFile);
                    // Create the log context and load into the selector for the module.
                    final LogContext logContext = LogContext.create();
                    LoggingExtension.CONTEXT_SELECTOR.registerLogContext(module.getClassLoader(), logContext);
                    deploymentUnit.putAttachment(LOG_CONTEXT_KEY, logContext);

                    // Get the filname and open the stream
                    final String fileName = configFile.getName();
View Full Code Here

Examples of org.jfree.util.LogContext

    /**
     * Tests the log context.
     */
    public void testLogContext() {
        final LogContext ctx = Log.createContext((String) null);
        assertEquals("Context = null", ctx, Log.createContext((String) null));

        final LogContext ctx2 = Log.createContext("Test");
        assertEquals("Context Test", ctx2, Log.createContext("Test"));

    }
View Full Code Here

Examples of org.jfree.util.LogContext

    /**
     * Tests the log context.
     */
    public void testLogContext() {
        final LogContext ctx = Log.createContext((String) null);
        assertEquals("Context = null", ctx, Log.createContext((String) null));

        final LogContext ctx2 = Log.createContext("Test");
        assertEquals("Context Test", ctx2, Log.createContext("Test"));

    }
View Full Code Here

Examples of org.jfree.util.LogContext

    /**
     * Tests the log context.
     */
    public void testLogContext() {
        final LogContext ctx = Log.createContext((String) null);
        assertEquals("Context = null", ctx, Log.createContext((String) null));

        final LogContext ctx2 = Log.createContext("Test");
        assertEquals("Context Test", ctx2, Log.createContext("Test"));

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.