Did you solve your OSGi issues?

Gary

On Thu, May 14, 2015 at 10:37 AM, Chathura Priyankara <
[email protected]> wrote:

> Hi,
>
> I think resources inside the META-INF of log4j2 core is not visible to
> log4j-api.
> That is why this error occurs.
> Any idea about this ?
>
> Thanks!
>
> On Thu, May 14, 2015 at 9:39 AM, Chathura Priyankara <
> [email protected]> wrote:
>
>> Hi,
>>
>> I want to use log4j2 OSGi bundles in one OSGi application. It is based on
>> Eclipse Equinox and consists of several modules. Apache Felix is the bundle
>> plugin.
>> To use log4j2 in this OSGi environment I added log4j-api, log4j-core and
>> log4j-jcl as maven dependencies like follows.
>>
>>    <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>
>>
>> (The application uses apache commons as the logging API).
>> I have added log4j2 configuration in to the bundle also.
>> Then I copied above three jars in to the dropins directory which is the
>> OSGi container in my case.
>>
>> However when I'm running this application I'm getting following exception.
>>
>> ERROR StatusLogger Log4j2 could not find a logging implementation. Please
>> add log4j-core to the classpath. Using SimpleLogger to log to the console
>>
>> As far as I understood this error comes because log4j2 api cannot find
>> the log4j-provider.properties file inside the META-INF of log4j-core.
>> I'm quite new to this, could you please tell me why I'm getting this
>> error and how to correct this ?
>> Any help is highly appreciated.
>>
>> Thanks!
>> Regards,
>> Chathura
>>
>> On Thu, May 14, 2015 at 9:38 AM, Chathura Priyankara <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> I want to use log4j2 OSGi bundles in one OSGi application. It is based
>>> on Eclipse Equinox and consists of several modules. Apache Felix is the
>>> bundle plugin.
>>> To use log4j2 in this OSGi environment I added log4j-api, log4j-core and
>>> log4j-jcl as maven dependencies like follows.
>>>
>>>    <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>
>>>
>>> (The application uses apache commons as the logging API).
>>> I have added log4j2 configuration in to the bundle also.
>>> Then I copied above three jars in to the dropins directory which is the 
>>> OSGi container in my case.
>>>
>>> However when I'm running this application I'm getting following exception.
>>>
>>> ERROR StatusLogger Log4j2 could not find a logging implementation. Please 
>>> add log4j-core to the classpath. Using SimpleLogger to log to the console
>>>
>>> As far as I understood this error comes because log4j2 api cannot find the 
>>> log4j-provider.properties file inside the META-INF of log4j-core.
>>> I'm quite new to this, could you please tell me why I'm getting this error 
>>> and how to correct this ?
>>> Any help is highly appreciated.
>>>
>>> Thanks!
>>> Regards,
>>> Chathura.
>>>
>>>
>>> On Thu, May 14, 2015 at 9:08 AM, Gary Gregory <[email protected]>
>>> wrote:
>>>
>>>> Please provide a precise description of what you are doing and seeing,
>>>> including the full stack trace. What version of Log4j are you using?
>>>>
>>>> Thank you,
>>>> Gary
>>>>
>>>> On Wed, May 13, 2015 at 1:36 AM, Chathura Priyankara <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> It seems like there is no proper guide about how to configure log4j2
>>>>> OSGi bundles correctly. Even though there is a fix [1] for the class
>>>>> loading issue I'm still getting add log4j2 implementation to the class 
>>>>> path
>>>>> exception in an OSGi environment.
>>>>>
>>>>> Can any one please guide me how correctly use log4j2 OSGi bundles in
>>>>> an OSGi environment ?
>>>>>
>>>>> [1] https://issues.apache.org/jira/browse/LOG4J2-373
>>>>>
>>>>> Thanks,
>>>>> Chathura.
>>>>>
>>>>> --
>>>>> Chathura Priyankara,
>>>>> Faculty of Information Technology,
>>>>> University of Moratuwa.
>>>>> Blog  : www.codeoncloud.blogspot.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: [email protected] | [email protected]
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>
>
>
>
> --
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com
>



-- 
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to