You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Zhemzhitsky Sergey <Se...@troika.ru> on 2011/10/06 18:23:00 UTC

How to configure list/array-based properties with pax-logging?

Hi there,

I would like to use http://logging.apache.org/log4j/companions/extras/index.html with pax-logging to be able to configure loggers more flexibly.
I have used maven-shade and maven-bundle plugins to shade org.apache.log4j packages from log4j-extras to prevent classloading conflicts with pax logging and to create an OSGi-fragment for org.ops4j.pax.logging.pax-logging-service bundle to be able to use new appenders.

Now I would like to configure new org.apache.log4j.rolling.RollingFileAppender from log4j-extras and set its triggeringPolicy property (http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html#setTriggeringPolicy%28org.apache.log4j.rolling.TriggeringPolicy%29) to CompositeTriggeringPolicy (http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/CompositeTriggeringPolicy.html)

The problem is I don't know how to specify in org.ops4j.pax.logging.cfg that CompositeTriggeringPolicy.addTriggeringPolicy(TriggeringPolicy) must be called in order to add a TriggeringPolicy.

It seems that org.apache.log4j.PaxLoggingConfigurator is responsible for handling org.ops4j.pax.logging.cfg, but it is not possible to replace or configure it somehow by means of OSGi services.

So I'm interested in whether it is possible to configure custom appenders more flexibly or to customize the way PaxLoggingConfigurator handles org.ops4j.pax.logging.cfg?


Best Regards,
Sergey Zhemzhitsky


_______________________________________________________

The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia. 
If you need assistance please contact our Contact Center  (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp  


RE: How to configure list/array-based properties with pax-logging?

Posted by Zhemzhitsky Sergey <Se...@troika.ru>.
Hi Achim,

Thanks for the link to your blog.

It seems that it will be necessary to create a wrapper appender in my case.

Best Regards,
Sergey

From: Achim Nierbeck [mailto:bcanhome@googlemail.com]
Sent: Friday, October 07, 2011 11:36 AM
To: user@karaf.apache.org
Subject: Re: How to configure list/array-based properties with pax-logging?

Hi,

I think you are in the right way by using a fragment to attach it to the logging api. I wrote a blog about "extending" the pax-logging, see [1].
Regarding the configuration if it is possible to configure the log4j-extras with std. porperty logging this should/could be possible.
AFAIR logging extras only supports xml configuration files which is not supported by pax logging since pax logging uses the config-admin service for it's configuration
which makes it flexible for runtime config changes :)

So one solution probably would be creating a  "wrapper" appender that calls the appender you want and configure it in the way you need it.

regrads, Achim


[1] - http://nierbeck.de/cgi-bin/weblog_basic/index.php?p=201
2011/10/6 Zhemzhitsky Sergey <Se...@troika.ru>>
Hi there,

I would like to use http://logging.apache.org/log4j/companions/extras/index.html with pax-logging to be able to configure loggers more flexibly.
I have used maven-shade and maven-bundle plugins to shade org.apache.log4j packages from log4j-extras to prevent classloading conflicts with pax logging and to create an OSGi-fragment for org.ops4j.pax.logging.pax-logging-service bundle to be able to use new appenders.

Now I would like to configure new org.apache.log4j.rolling.RollingFileAppender from log4j-extras and set its triggeringPolicy property (http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html#setTriggeringPolicy%28org.apache.log4j.rolling.TriggeringPolicy%29) to CompositeTriggeringPolicy (http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/CompositeTriggeringPolicy.html)

The problem is I don't know how to specify in org.ops4j.pax.logging.cfg that CompositeTriggeringPolicy.addTriggeringPolicy(TriggeringPolicy) must be called in order to add a TriggeringPolicy.

It seems that org.apache.log4j.PaxLoggingConfigurator is responsible for handling org.ops4j.pax.logging.cfg, but it is not possible to replace or configure it somehow by means of OSGi services.

So I'm interested in whether it is possible to configure custom appenders more flexibly or to customize the way PaxLoggingConfigurator handles org.ops4j.pax.logging.cfg?


Best Regards,
Sergey Zhemzhitsky


_______________________________________________________



The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia.

If you need assistance please contact our Contact Center (+7495) 258 0500<tel:%28%2B7495%29%20258%200500> or go to www.troika.ru/eng/Contacts/system.wbp<http://www.troika.ru/eng/Contacts/system.wbp>





--
--
*Achim Nierbeck*


Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>  Committer & Project Lead
blog <http://notizblog.nierbeck.de/>

_______________________________________________________

The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia. 
If you need assistance please contact our Contact Center  (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp  


Re: How to configure list/array-based properties with pax-logging?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

I think you are in the right way by using a fragment to attach it to the
logging api. I wrote a blog about "extending" the pax-logging, see [1].
Regarding the configuration if it is possible to configure the log4j-extras
with std. porperty logging this should/could be possible.
AFAIR logging extras only supports xml configuration files which is not
supported by pax logging since pax logging uses the config-admin service for
it's configuration
which makes it flexible for runtime config changes :)

So one solution probably would be creating a  "wrapper" appender that calls
the appender you want and configure it in the way you need it.

regrads, Achim


[1] - http://nierbeck.de/cgi-bin/weblog_basic/index.php?p=201

2011/10/6 Zhemzhitsky Sergey <Se...@troika.ru>

>  Hi there,****
>
> ** **
>
> I would like to use
> http://logging.apache.org/log4j/companions/extras/index.html with
> pax-logging to be able to configure loggers more flexibly.****
>
> I have used maven-shade and maven-bundle plugins to shade org.apache.log4j
> packages from log4j-extras to prevent classloading conflicts with pax
> logging and to create an OSGi-fragment for
> org.ops4j.pax.logging.pax-logging-service bundle to be able to use new
> appenders.****
>
> ** **
>
> Now I would like to configure new
> org.apache.log4j.rolling.RollingFileAppender from log4j-extras and set its
> triggeringPolicy property (
> http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html#setTriggeringPolicy%28org.apache.log4j.rolling.TriggeringPolicy%29)
> to CompositeTriggeringPolicy (
> http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/CompositeTriggeringPolicy.html
> )****
>
> ** **
>
> The problem is I don’t know how to specify in org.ops4j.pax.logging.cfg
> that CompositeTriggeringPolicy.addTriggeringPolicy(TriggeringPolicy) must be
> called in order to add a TriggeringPolicy.****
>
> ** **
>
> It seems that org.apache.log4j.PaxLoggingConfigurator is responsible for
> handling org.ops4j.pax.logging.cfg, but it is not possible to replace or
> configure it somehow by means of OSGi services.****
>
> ** **
>
> So I’m interested in whether it is possible to configure custom appenders
> more flexibly or to customize the way PaxLoggingConfigurator handles
> org.ops4j.pax.logging.cfg?****
>
> ** **
>
> ** **
>
> Best Regards,****
>
> Sergey Zhemzhitsky****
>
> ** **
>
> _______________________________________________________
>
>
>
> The information contained in this message may be privileged and conf
> idential and protected from disclosure. If you are not the original intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, or other use of, or taking of any action in reliance upon,
> this information is prohibited. If you have received this communication in
> error, please notify the sender immediately by replying to this message and
> delete it from your computer. Thank you for your cooperation. Troika Dialog,
> Russia.
>
> If you need assistance please contact our Contact Center (+7495) 258 0500or go to
> www.troika.ru/eng/Contacts/system.wbp
>
>
>



-- 
--
*Achim Nierbeck*


Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>  Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>