You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Charles Moulliard <cm...@gmail.com> on 2010/06/08 14:18:00 UTC

OSGI - Bundle - log4j

Hi,

Can we do something like that ?

Bundle 1 : packages --> com.mycompany.myservice.model --> fileAppender
: bundles1.log
Bundle 2 : packages --> com.mycompany.myservice.model --> fileAppender
: bundles2.log

Remark : the package names are the same but deployed in two different bundles.

KR,

Charles Moulliard

Senior Enterprise Architect (J2EE, .NET, SOA)
Apache Camel/ServiceMix Committer

*******************************************************************
- Blog : http://cmoulliard.blogspot.com
- Twitter : http://twitter.com/cmoulliard
- Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Re: OSGI - Bundle - log4j

Posted by Guillaume Nodet <gn...@gmail.com>.
I mean i've done that in pax-logging sorry.

On Wed, Jun 9, 2010 at 08:38, Guillaume Nodet <gn...@gmail.com> wrote:

> I've done that already in log4j.  If you look at the latest karaf
> pax-logging configuration file, you should see what you need.
> You can split the logs per bundle now.
>
>
> On Wed, Jun 9, 2010 at 08:21, Jean-Baptiste Onofré <jb...@nanthrax.net>wrote:
>
>> Hi Charles,
>>
>> If your two bundles use the same package name, the only way to achieve
>> that is to package a log4j.xml in your bundle classpath.
>> It's not possible to use a global ops4j logging property file as it will
>> not be able to distinguish the two bundles.
>> Maybe we can make an pax-logging improvement to use
>> ThreadContextClassLoader to load the log4j or something like that but, in
>> state, definetely, it's not possible.
>>
>> Regards
>> JB
>>
>>
>> On 06/08/2010 02:18 PM, Charles Moulliard wrote:
>>
>>> Hi,
>>>
>>> Can we do something like that ?
>>>
>>> Bundle 1 : packages -->  com.mycompany.myservice.model -->  fileAppender
>>> : bundles1.log
>>> Bundle 2 : packages -->  com.mycompany.myservice.model -->  fileAppender
>>> : bundles2.log
>>>
>>> Remark : the package names are the same but deployed in two different
>>> bundles.
>>>
>>> KR,
>>>
>>> Charles Moulliard
>>>
>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>> Apache Camel/ServiceMix Committer
>>>
>>> *******************************************************************
>>> - Blog : http://cmoulliard.blogspot.com
>>> - Twitter : http://twitter.com/cmoulliard
>>> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: OSGI - Bundle - log4j

Posted by Charles Moulliard <cm...@gmail.com>.
I suppose that I can do that using the following syntax :

# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=karaf
log4j.appender.sift.appender=org.apache.log4j.FileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} |
%-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n
log4j.appender.sift.appender.file=${karaf.base}/data/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true

KR,


Charles Moulliard

Senior Enterprise Architect (J2EE, .NET, SOA)
Apache Camel/ServiceMix Committer

*******************************************************************
- Blog : http://cmoulliard.blogspot.com
- Twitter : http://twitter.com/cmoulliard
- Linkedlin : http://www.linkedin.com/in/charlesmoulliard



On Wed, Jun 9, 2010 at 8:38 AM, Guillaume Nodet <gn...@gmail.com> wrote:
> I've done that already in log4j.  If you look at the latest karaf
> pax-logging configuration file, you should see what you need.
> You can split the logs per bundle now.
>
> On Wed, Jun 9, 2010 at 08:21, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
>> Hi Charles,
>>
>> If your two bundles use the same package name, the only way to achieve that
>> is to package a log4j.xml in your bundle classpath.
>> It's not possible to use a global ops4j logging property file as it will
>> not be able to distinguish the two bundles.
>> Maybe we can make an pax-logging improvement to use
>> ThreadContextClassLoader to load the log4j or something like that but, in
>> state, definetely, it's not possible.
>>
>> Regards
>> JB
>>
>>
>> On 06/08/2010 02:18 PM, Charles Moulliard wrote:
>>
>>> Hi,
>>>
>>> Can we do something like that ?
>>>
>>> Bundle 1 : packages -->  com.mycompany.myservice.model -->  fileAppender
>>> : bundles1.log
>>> Bundle 2 : packages -->  com.mycompany.myservice.model -->  fileAppender
>>> : bundles2.log
>>>
>>> Remark : the package names are the same but deployed in two different
>>> bundles.
>>>
>>> KR,
>>>
>>> Charles Moulliard
>>>
>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>> Apache Camel/ServiceMix Committer
>>>
>>> *******************************************************************
>>> - Blog : http://cmoulliard.blogspot.com
>>> - Twitter : http://twitter.com/cmoulliard
>>> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>

Re: OSGI - Bundle - log4j

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Guillaume,

thanks for the update :)

Regards
JB

On 06/09/2010 08:38 AM, Guillaume Nodet wrote:
> I've done that already in log4j.  If you look at the latest karaf
> pax-logging configuration file, you should see what you need.
> You can split the logs per bundle now.
>
> On Wed, Jun 9, 2010 at 08:21, Jean-Baptiste Onofré<jb...@nanthrax.net>  wrote:
>
>> Hi Charles,
>>
>> If your two bundles use the same package name, the only way to achieve that
>> is to package a log4j.xml in your bundle classpath.
>> It's not possible to use a global ops4j logging property file as it will
>> not be able to distinguish the two bundles.
>> Maybe we can make an pax-logging improvement to use
>> ThreadContextClassLoader to load the log4j or something like that but, in
>> state, definetely, it's not possible.
>>
>> Regards
>> JB
>>
>>
>> On 06/08/2010 02:18 PM, Charles Moulliard wrote:
>>
>>> Hi,
>>>
>>> Can we do something like that ?
>>>
>>> Bundle 1 : packages -->   com.mycompany.myservice.model -->   fileAppender
>>> : bundles1.log
>>> Bundle 2 : packages -->   com.mycompany.myservice.model -->   fileAppender
>>> : bundles2.log
>>>
>>> Remark : the package names are the same but deployed in two different
>>> bundles.
>>>
>>> KR,
>>>
>>> Charles Moulliard
>>>
>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>> Apache Camel/ServiceMix Committer
>>>
>>> *******************************************************************
>>> - Blog : http://cmoulliard.blogspot.com
>>> - Twitter : http://twitter.com/cmoulliard
>>> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>
>
>

Re: OSGI - Bundle - log4j

Posted by Guillaume Nodet <gn...@gmail.com>.
I've done that already in log4j.  If you look at the latest karaf
pax-logging configuration file, you should see what you need.
You can split the logs per bundle now.

On Wed, Jun 9, 2010 at 08:21, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:

> Hi Charles,
>
> If your two bundles use the same package name, the only way to achieve that
> is to package a log4j.xml in your bundle classpath.
> It's not possible to use a global ops4j logging property file as it will
> not be able to distinguish the two bundles.
> Maybe we can make an pax-logging improvement to use
> ThreadContextClassLoader to load the log4j or something like that but, in
> state, definetely, it's not possible.
>
> Regards
> JB
>
>
> On 06/08/2010 02:18 PM, Charles Moulliard wrote:
>
>> Hi,
>>
>> Can we do something like that ?
>>
>> Bundle 1 : packages -->  com.mycompany.myservice.model -->  fileAppender
>> : bundles1.log
>> Bundle 2 : packages -->  com.mycompany.myservice.model -->  fileAppender
>> : bundles2.log
>>
>> Remark : the package names are the same but deployed in two different
>> bundles.
>>
>> KR,
>>
>> Charles Moulliard
>>
>> Senior Enterprise Architect (J2EE, .NET, SOA)
>> Apache Camel/ServiceMix Committer
>>
>> *******************************************************************
>> - Blog : http://cmoulliard.blogspot.com
>> - Twitter : http://twitter.com/cmoulliard
>> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: OSGI - Bundle - log4j

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Charles,

If your two bundles use the same package name, the only way to achieve 
that is to package a log4j.xml in your bundle classpath.
It's not possible to use a global ops4j logging property file as it will 
not be able to distinguish the two bundles.
Maybe we can make an pax-logging improvement to use 
ThreadContextClassLoader to load the log4j or something like that but, 
in state, definetely, it's not possible.

Regards
JB

On 06/08/2010 02:18 PM, Charles Moulliard wrote:
> Hi,
>
> Can we do something like that ?
>
> Bundle 1 : packages -->  com.mycompany.myservice.model -->  fileAppender
> : bundles1.log
> Bundle 2 : packages -->  com.mycompany.myservice.model -->  fileAppender
> : bundles2.log
>
> Remark : the package names are the same but deployed in two different bundles.
>
> KR,
>
> Charles Moulliard
>
> Senior Enterprise Architect (J2EE, .NET, SOA)
> Apache Camel/ServiceMix Committer
>
> *******************************************************************
> - Blog : http://cmoulliard.blogspot.com
> - Twitter : http://twitter.com/cmoulliard
> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard