I have now committed the logging code change to master and 3.1.x.
https://github.com/apache/cxf/commit/3d3e99d4efe2185b8dc156bf65892c3aa8707133
You can already use it if you build CXF from source and install the
current snapshot or just use similar code to export the intent in your
own code.
I have also extended the documentation of the CXF-DOSGi rest example to
show how to use the new logging intent:
https://github.com/apache/cxf-dosgi/tree/master/samples/rest
This should already work with the CXF-DOSGi 2.0.0 distro as we do not
need any changes there.
I think this should at least work very well for the logging feature. Of
course we can use the same pattern for other commonly used features to
make them really easy to apply.
Christian
On 04.11.2016 11:48, Christian Schneider wrote:
In CXF-DOSGi 2 there is no property for setting interceptors.
Currently the only way is to use intents.
See:
https://github.com/apache/cxf-dosgi/tree/master/common
Here is an example for an intent:
https://github.com/apache/cxf-dosgi/blob/master/samples/ssl/ssl-intent/src/main/java/org/apache/cxf/dosgi/samples/ssl/SslIntent.java
The idea is to simply export an OSGi service with the LoggingFeature
and setting a property org.apache.cxf.dosgi.IntentName=logging.
You can then use the property service.exported.intents=logging on your
remote service. CXF DOSGi will wait till all named intents are present
and then add them to your service
before publishing it.
I am currently working on a change to the new logging support to
automatically export an intent service named logging. Then you can
simply add the property to your service and do not have to publish the
intent yourself.
See https://issues.apache.org/jira/browse/CXF-7125
I will shortly commit the code so you can see how it works.
Currently this is not very well documented so let me know if you run
into problems.
Btw. We also would like to get feedback if the intent approach is good
or if you would prefer something else.
The reason for the intent approach is that it does not have any
classloading issues and it allows to configure the intent using e.g.
config admin. Another important
point is that the intent name is also stored in discovery. So an
automatically created client will also get the intent applied.
We are aware that it is a more effort to setup though. So I would like
to hear what your experiences are with it in practice.
Christian
Btw. For now there is also a nice workaround for logging. See Auto
logging in the link below:
http://cxf.apache.org/docs/message-logging.html
Activating it will install logging to all CXF endpoints and clients
including the DOSGi ones. Be aware though that the logging feature
must start before your service to make it work.
On 04.11.2016 11:24, nino martinez wael wrote:
cxf-dosgi-2.0.0
On Fri, Nov 4, 2016 at 11:21 AM, Christian Schneider <
[email protected]> wrote:
Which DOSGi version do you use?
Christian
On 04.11.2016 11:11, nino martinez wael wrote:
Hi
I cannot get a request logger working I've tried this:
"org.apache.cxf.rs.in.interceptors=org.apache.cxf.intercepto
r.LoggingInInterceptor"
But log remains silent, im using a plain karaf.. Do loglevels need
to set
anything specific?
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com