users@glassfish.java.net

Help with setting up Slf4j/Log4j in a web app running on Glassfish v4

From: John McDonnell <mcdonnell.john_at_gmail.com>
Date: Sun, 16 Jun 2013 22:20:15 +0100

Hi all,

I have recently started using GF v4 (GlassFish Server Open Source Edition
4.0 (build 89) to be exact), and as part of my initial investigation I
attempted to take an application that I know runs in Tomcat, and migrate it
over to GF v4.


I'm having an issue with getting my logs for the application to show up,
where when I start an application I receive the following error:
SEVERE: log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not
assignable to a "org.apache.log4j.Appender" variable.
SEVERE: log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
SEVERE: log4j:ERROR [WebappClassLoader (delegate=true;
repositories=WEB-INF/classes/)] whereas object of type
SEVERE: log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by
[WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)].
SEVERE: log4j:ERROR Could not instantiate appender named "R".
SEVERE: log4j:WARN No appenders could be found for logger
(org.jboss.logging).
SEVERE: log4j:WARN Please initialize the log4j system properly.
SEVERE: log4j:WARN See
http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


My maven dependency is declared as:
<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
        </dependency>

Anyone have any ideas about this error?

-- 
John