logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Problems with log4j 2
Date Sun, 24 Mar 2013 15:27:24 GMT
Can you provide the list of jars you have on your classpath?

Ralph

On Mar 23, 2013, at 11:08 PM, wangke wrote:

> Hi all:
> I am trying to get this simple example working, I included all the jars in apache-log4j-2.0-beta4-bin
> 
> import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger; public
class HelloWorld {    private static Logger logger = LogManager.getLogger("HelloWorld"); 
  public static void main(String[] args) {        logger.info("Hello, World!");    }}
> Here is the exception I am getting in eclipse:Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/spi/LocationAwareLogger
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:342)
> 	at test.HelloWorld.<clinit>(HelloWorld.java:7)
> Caused by: java.lang.ClassNotFoundException: org.slf4j.spi.LocationAwareLogger
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 3 more
> Then I've added slf4j-api-1.7.2.jar. I've still couldn't get it working with what looks
like a non-terminated recursive loop eventually overflowing my stack.Exception in thread "main"
java.lang.StackOverflowError
> 	at java.lang.Throwable.getStackTraceDepth(Native Method)
> 	at java.lang.Throwable.getOurStackTrace(Throwable.java:588)
> 	at java.lang.Throwable.getStackTrace(Throwable.java:582)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getContext(Log4JLoggerFactory.java:75)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:45)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:52)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270) 
> Can anybody pls help? Thanks a lot.
> Ke 		 	   		   		 	   		   		 	   		   		 	   		  


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message