You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Chathura Priyankara <pr...@gmail.com> on 2015/04/22 05:47:55 UTC

[Dev][lo4j2] Could not find a logging implementation in osgi bundle.

Hi,

I'm trying to use log4j2 in an OSGI bundle, but when I'm running the
application I'm getting the following error

ERROR StatusLogger Log4j2 could not find a logging implementation. Please
add log4j-core to the classpath. Using SimpleLogger to log to the console

I found in [1] that there is a fix for this issue, but still I could not
able to fix this. Can any one please explain me why I'm getting this error
and how can I resolve this ?

[1]
http://stackoverflow.com/questions/25669636/error-statuslogger-log4j2-could-not-find-a-logging-implementation-please-add-lo

Thanks!
Best Regards,
Chathura.

-- 
Chathura Priyankara,
Faculty of Information Technology,
University of Moratuwa.
Blog  : www.codeoncloud.blogspot.com

Re: [Dev][lo4j2] Could not find a logging implementation in osgi bundle.

Posted by Chathura Priyankara <pr...@gmail.com>.
Hi,

Currently I'm using single osgi bundler for all following dependencies.

     <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.2</version>
    </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-jcl</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-1.2-api</artifactId>
            <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>2.2</version>
    </dependency>

and use packages as follows

  <Import-Package>
          !org.apache.log4j.*,
           *;resolution:=optional
  </Import-Package>
   <Export-Package>
           org.apache.logging.log4j.*;version="${version.log4j}",
           org.apache.logging.log4j.core.*;version="${version.log4j}",
           org.apache.logging.slf4j.*;version="${version.log4j}",
           org.slf4j.impl.*;version="${version.log4j}",
          org.apache.log4j.*;version="${version.log4j}"
  </Export-Package>

Do I need to create separate bundles for all these packages ?

Thanks!

On Wed, Apr 22, 2015 at 9:17 AM, Chathura Priyankara <
priyankarahac@gmail.com> wrote:

> Hi,
>
> I'm trying to use log4j2 in an OSGI bundle, but when I'm running the
> application I'm getting the following error
>
> ERROR StatusLogger Log4j2 could not find a logging implementation. Please
> add log4j-core to the classpath. Using SimpleLogger to log to the console
>
> I found in [1] that there is a fix for this issue, but still I could not
> able to fix this. Can any one please explain me why I'm getting this error
> and how can I resolve this ?
>
> [1]
> http://stackoverflow.com/questions/25669636/error-statuslogger-log4j2-could-not-find-a-logging-implementation-please-add-lo
>
> Thanks!
> Best Regards,
> Chathura.
>
> --
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com
>



-- 
Chathura Priyankara,
Faculty of Information Technology,
University of Moratuwa.
Blog  : www.codeoncloud.blogspot.com