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 <[email protected]> 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é <[email protected]> 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
>

Reply via email to