logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-204) java.lang.NoClassDefFoundError: org/slf4j/spi/LocationAwareLogger
Date Wed, 10 Apr 2013 01:07:13 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13627330#comment-13627330
] 

Ralph Goers commented on LOG4J2-204:
------------------------------------

Let's try this a different way.  What are you trying to do?  You obviously have the Log4j
2 API jar because that is where LogManager.getLogger() comes from.  You also have the log4j-to-slf4j
jar since that is where org.apache.logging.slf4j.SLF4JLoggerContext.getLogger() comes from.
But why would you want to route the Log4j API to SLF4J if you don't have the SLF4J jar on
the class path and apparently don't know what it is?  Are you simply including ALL the Log4j
jars in your classpath?  If so, you cannot do that as some of them are mutually exclusive.
 If you want to have Log4j 2 handle your logging only include the Log4j APi and Log4j Core
jars.
                
> java.lang.NoClassDefFoundError: org/slf4j/spi/LocationAwareLogger
> -----------------------------------------------------------------
>
>                 Key: LOG4J2-204
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-204
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta4
>         Environment: Product Version: NetBeans IDE 7.3 (Build 201302132200)
> Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
> Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
> System: Windows 7 version 6.1 running on amd64; Cp1250; pl_PL (nb)
> User directory: C:\Users\Wojtek\AppData\Roaming\NetBeans\7.3
> Cache directory: C:\Users\Wojtek\AppData\Local\NetBeans\Cache\7.3
>            Reporter: Wojciech Zaręba
>              Labels: newbie
>         Attachments: error.log
>
>
> Very simple source:
> package loggerimpl;
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
> public class LoggerImpl {
>     private static Logger logg = LogManager.getLogger(LoggerImpl.class.getName());
>     public static void main(String[] args) {
>         logg.info("Pierwsze info");
>         logg.debug("Drugi debug");
>         logg.warn("Trzeci warning");
>         logg.trace("Czwarty trace");
>         logg.error("Piąty ERROR");
>         logg.fatal("Szósty F A T A L");
>     }
> }
> produces error:
> 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 loggerimpl.LoggerImpl.<clinit>(LoggerImpl.java:11)
> Caused by: java.lang.ClassNotFoundException: org.slf4j.spi.LocationAwareLogger
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         .. 3 more
> Exception in thread "main" Java Result: 1
> I can't find in bins/sources org.slf4j.spi.LocationAwareLogger
> Regards
> Wojciech Zaręba

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message