logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Druskat <stephan.drus...@uni-jena.de>
Subject Re: Using log4j2 2.1 over slf4j 1.7.7 in Eclipse RCP
Date Wed, 26 Nov 2014 10:46:58 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

I got it to work via buddy classloading. Will do a wee write-up and
post it here so you can include it in the FAQ :).

Thanks for the pointers.

Best,
Stephan

Am 24.11.2014 um 17:38 schrieb Stephan Druskat:
> Hi again, Gary,
> 
> playin log4j2 thjrows the same exception btw.
> 
> Best, Stephan
> 
> Am 24.11.2014 um 12:56 schrieb Gary Gregory:
>> Can you get plain log4j to work first? That would be a good
>> sanity check.
> 
>> Gary
> 
>> <div>-------- Original message --------</div><div>From: Stephan

>> Druskat <stephan.druskat@uni-jena.de> </div><div>Date:11/24/2014

>> 04:58  (GMT-05:00) </div><div>To: log4j-user@logging.apache.org 
>> </div><div>Cc:  </div><div>Subject: Using log4j2 2.1 over
slf4j 
>> 1.7.7 in Eclipse RCP </div><div> </div>Dear List,
> 
>> I'm developing an Eclipse RCP based on Eclipse 3.7.2 (Indigo).
> 
>> I'd like to use log4j2 (2.1) over slf4j 1.7.7, but I'm having 
>> trouble getting it to work. I have done the following to add
>> log4j2 and slf4j to my application.
> 
>> - I've built a p2 repo including slf4j.api_1.7.7.jar, 
>> org.apache.logging.log4j.core_2.1.0.jar, 
>> org.apache.logging.log4j.api_2.1.0.jar, 
>> org.apache.logging.log4j.slf4j-impl_2.1.0.jar.
> 
>> - I've consumed this p2 repo in my target platform + added it to 
>> the parent POM of my project.
> 
>> - I've added all 4 plugins to my Eclipse plugin project as 
>> dependencies in MANIFEST.MF.
> 
>> - I've created a file log4j2.xml in the project root in my
>> Eclipse plugin. Content below.
> 
>> - I've added a private static final Logger logger = 
>> LoggerFactory.getLogger(MyClass.class) field to MyClass
> 
>> - In MyClass, I've called logger.error("Hi from logger").
> 
>> However, when I run my application, I'm getting an error
>> message: ERROR StatusLogger Log4j2 could not find a logging
>> implementation. Please add log4j-core to the classpath. Using
>> SimpleLogger to log to the console...
> 
>> So it seems that log4j is up and running, and that slf4j can
>> "use" log4j.
> 
>> I've also copied the log4j-core JAR into a dedicated directory
>> in my plugin, and added it to the Bundle-ClassPath in
>> MANIFEST.MF, albeit to no avail.
> 
>> I'd be more than happy if someone who is using the same or a 
>> similar setup could point me in the right direction of what I'm 
>> missing out.
> 
>> Many thanks! Stephan
> 
> 
>> log4j2.xml:
> 
>> <?xml version="1.0" encoding="UTF-8"?> <Configuration 
>> status="WARN"> <Appenders> <Console name="console" 
>> target="SYSTEM_OUT"> <PatternLayout pattern="[%-5level] 
>> %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/> </Console> 
>> </Appenders> <Loggers> <Root level="info" additivity="false"> 
>> <AppenderRef ref="console"/> </Root> </Loggers> </Configuration>
> 
>> ---------------------------------------------------------------------
>
>> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: 
>> log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail:
> log4j-user-help@logging.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUda+iAAoJEOa63YqBeAN2clwH/i7RjwnnOMxCw2WAMPHpmaW4
XEwTppWv9Izf6EPEkXnCx3o1wf2ahQNc6ZkbZqMpqmRcMPWYHHsAW5ANMH12MzyC
phrHerIwKrTmSj5xkyoG6V8th6+DiLfpXdTNDgquctoqvUOnF1K2gwQUsSs7dBIH
yn+momHBHAIewc3MSIA0XPg5S3p/5A1P1qRwQMJT8DMLFO6O2s0Jn0cWUEey0rgw
axrP0suucFNOMC/a8wNu15BuJVFklAmXXR4wR+obaiZGrdgS2n3el3nmjLN2HlM+
OvqaFgcWwVqLSZw6rGL/ljDZ8slAD00AmsvhZUBBuo9GO1Iq+ch7GGx5Ss3KZgA=
=6+7B
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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