/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2009, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.slf4j.impl;

import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.jboss.logmanager.LogContext;

public final class Slf4jLoggerFactory implements ILoggerFactory {

    public Logger getLogger(final String name) {
        return new Slf4jLogger(LogContext.getLogContext().getLogger(name));
    }
}

@@ -1217,16 +1217,155 @@
 tory %7B%0A%0A
+    private static final org.jboss.logmanager.Logger.AttachmentKey%3CLogger%3E key = new org.jboss.logmanager.Logger.AttachmentKey%3CLogger%3E();%0A%0A
     publ
@@ -1417,31 +1417,53 @@
     
-return new Slf4j
+final org.jboss.logmanager.Logger lm
 Logger
-(
+ = 
 LogC
@@ -1500,17 +1500,357 @@
 er(name)
-)
+;%0A        final Logger logger = lmLogger.getAttachment(key);%0A        if (logger != null) %7B%0A            return logger;%0A        %7D%0A        final Slf4jLogger newLogger = new Slf4jLogger(lmLogger);%0A        final Logger appearingLogger = lmLogger.attachIfAbsent(key, newLogger);%0A        return appearingLogger != null ? appearingLogger : newLogger
 ;%0A    %7D%0A

Use typesafe attachment API to cache SLF4J loggers