Hi Sven

Ok, thanks for your investigation so far,
Cheers. Sergey
On 14/03/12 10:45, Viehmeier, Sven wrote:
Hi Sergey,

Thanks for your reply. I created JIRA 113 
(https://issues.apache.org/jira/browse/DOSGI-113).
Currently, I have no time to try a different container since I will stop 
working on this project in the next days and pass it to my supervisor. But 
since the project will be continued, my supervisor will follow the JIRA and 
perhaps get in contact with you as soon as he investigates the logging problem.

Thank you very much for your help so far.

Kind regards,
Sven

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: 13 March 2012 23:41
To: [email protected]
Subject: Re: Configure logging in CXF + pax-web + Jetty

Hi Sven
Sorry for a delay...
Unfortunately I've no scope right now for investigating DOSGI-related
issues until CXF 2.6.0 is out.

Can you please open a JIRA for this issue be tracked at least ?
Also if you could try one of the Karaf-based distros with CXF deployed
(example, Talend TESB, etc) and track what is done there to get the
logging managed properly, then it would help :-). This is the only way I
can think of right now as I just do not know the right answer re what
needs to be done in DOSGI CXF :-)

Actually, I wonder if deploying DOSGi RI into Karaf would 'fix' the
problem. I did deploy 1.3-SNAPSHOT, just before the release, into the
Karaf container within the Talend distro and it worked fine, but I did
not pay the attention at the time to the logging.

I kind of suspect the issue is container-specific as opposed to DOSGI
CXF specific, but I may be wrong

Thanks, Sergey

On 09/03/12 16:02, Viehmeier, Sven wrote:
I have an addition. I had a closer look at the source code of the LogUtils class. If I saw it correctly, the 
LogUtils class also checks the META-INF/cxf folder in the cxf-bundle-minimal jar for a file called 
"org.apache.cxf.Logger". If it finds this file or the system property, it should log "Using 
" + loggerClass.getName() + " for logging.".

So I injected a file named "org.apache.cxf.Logger" with the content 
"org.apache.cxf.common.logging.Log4jLogger" into the jar and ran my application again. 
But I do not get any output what logger class it uses and still see the log messages that I want to 
get rid of.

Btw. I am using the multibundle version of CXF D-OSGi 1.3.

Cheers,
Sven

-----Original Message-----
From: Viehmeier, Sven [mailto:[email protected]]
Sent: 08 March 2012 17:03
To: [email protected]
Subject: RE: Configure logging in CXF + pax-web + Jetty

Hi Sergey,

A while ago, I tried to configure logging in CXF D-OSGi. I deferred this task 
since I had some higher priority tasks to do, but now I am confronted with this 
problem again.

In the meantime, I was able to get pax-logging working with my own application. So all 
logging output that I do through the standard Log4J interface 
("org.apache.log4j.Logger") gets directed to pax-logging. I just had to make 
sure that there are no other bundles exporting the same logging interfaces in my 
container.

But CXF, on the other hand, still logs to the console. In detail, I get this 
log output for each request that is sent to my application:
08-Mar-2012 16:29:10 
org.apache.cxf.dosgi.dsw.handlers.SecurityDelegatingHttpContext handleSecurity
INFO: No filter registered.

I checked the source for this logging output and it is produced by a logger that comes 
from "LogUtils.getL7dLogger(SecurityDelegatingHttpContext.class);". I checked 
this one again and it uses java.util.logging by default. I thought that maybe 
java.util.logging is not redirected to pax-logging (although it should be possible).

So  I tried to switch CXF to Log4j since this is definitely send to pax-logging. Therefore, I had a 
look at the link you provided last time and found the possibility to set the system property " 
-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger". To be on the save side, I 
checked if the Log4jLogger class uses "org.apache.log4j.Logger"; According to the source 
I found, it should use this class. Therefore, output done via Log4jLogger should be redirected to 
pax-logging.

So I tried to set the system property in my Felix container. I set it when starting Felix 
from the command line and I set it in a file called "system.properties" in the 
Felix configuration directory. But I am still getting the same log messages. So I guess 
that CXF does not find the system property.

Does anybody have an idea where to set this property in Felix (and perhaps also 
in Eclipse) so that CXF can find it? I could also try the second possibility 
with the file on the classpath, but I am not sure how to do it. My first idea 
was a fragment bundle, but since I am now using the multibundle version of CXF, 
I have no idea to what bundle I have to attach the fragment.

Many thanks in advance,
Sven

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: 15 February 2012 09:57
To: [email protected]
Subject: Re: Configure logging in CXF + pax-web + Jetty

Hi Sven
On 14/02/12 16:40, Viehmeier, Sven wrote:
Hi Sergey,

Thanks for your reply. I had a look at the links. If I understand the function 
of the different bundles correct, you ran a zookeeper instance in your OSGi 
container using the cxf-dosgi-ri-discovery-distributed-zookeeper-server bundle 
and configured it using 
cxf-dosgi-ri-discovery-distributed-zookeeper-server-config. The difference to 
my case is that I need to use an independent zookeeper instance running in a 
separate virtual machine. CXF seems to find the zookeeper instance since I see 
some log output with the zookeeper IP and I also see log outputs telling me 
about the endpoint URL of the service that I want to communicate with. The 
problem is that my ServiceTracker still does not recognize the service.

I run a zookeeper instance in a separate JVM, but I did set a -D system
property when starting a Felix instance to make sure no random port is
picked up. The guide at
http://cxf.apache.org/dosgi-discovery.html

is out of date so after observing the discovery demo not working as
expected I installed those 2 extra bundles, set the system property and
it started working... To be honest I'm not even sure those two bundles
made a difference :-), all I was concerned about was to make sure the
existing demo was still working, the distributed discovery was of the
least concern for 1.3, rather it was to solve various minor but blocking
issues and kick start the process again... Nothing changed with respect
to the distributed discovery except that the legacy zookeeper wrapper
bundle was removed.

Please try the discovery demo - and if you can't make it work then I'll
try to reproduce the way I did it.

Concerning the logs that I get. Do you think they come from the container itself? Because 
there are many logs on the console starting with " org.apache.cxf". I would 
have guessed that they come from one of the CXF bundles and that CXF is using a certain 
logging framework like log4j. Do you perhaps know which framework is used for CXF so I 
can first try to configure CXF and then see where the other logs come from?


CXF should be able to work with different logging frameworks, please see
this section:
http://cxf.apache.org/docs/debugging-and-logging.html#DebuggingandLogging-LoggingMessages

Cheers, Sergey

Cheers,
Sven

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: 14 February 2012 15:45
To: [email protected]
Subject: Re: Configure logging in CXF + pax-web + Jetty

Hi,

On 14/02/12 13:02, Viehmeier, Sven wrote:
Hello,

I already mentioned it in a previous mail, but decided to make a new one since 
it seems to be a bigger issue.
At the moment, I try to run CXF with the pax-web bundle to be able to configure 
the Jetty server provided by pax-web. This combination is working with CXF 1.2 
single bundle distribution, but all the bundles log such a huge amount of 
information on the console that it slows down my application. Therefore, I 
tried to disable logging for both bundles, but I did not have success yet. Here 
is what I tried so far:

-          Create fragment bundles with a log4j.properties and attach them to 
CXF and pax-web; had no effect

-          Configure the log level using system properties like 
-Dorg.ops4j.pax.logging.DefaultServiceLog.level; had no effect

-          Add pax-logging to my container; Problems here:

o   the single bundle versions of CXF have logging frameworks included so I 
cannot use them

o   CXF version 1.2 multibundle needs the package org.apache.log4j.jmx which is 
not exported by pax-logging

o   CXF version 1.3 multibundle does not need this package, but I did not get 
it to work with my zookeeper (my services are not found anymore)

I did manage to run a discovery sample just before doing the release,
I got the following bundles added:
http://svn.apache.org/viewvc/cxf/dosgi/tags/cxf-dosgi-ri-1.3/distribution/multi-bundle/src/main/resources/distro_discovery_bundles.xml?view=markup

and I think I had to set a system property as shown in
http://svn.apache.org/viewvc/cxf/dosgi/tags/cxf-dosgi-ri-1.3/discovery/distributed/zookeeper-server-config/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/config/Activator.java?revision=1239591&view=markup

though I guess one can set it up from the shell...


I think there is at least one way to configure the logging in each of these 
frameworks (CXF, pax-web, Jetty). Pax-logging should be the most generic 
solution so I can tell you more about my problems with it if there is no easier 
way to configure the logging. Does anybody have some more hints what I could 
try?

Here are some examples of the log messages that I want to get rid of:
Feb 14, 2012 12:48:15 PM 
org.apache.cxf.dosgi.discovery.zookeeper.InterfaceDataMonitorListenerImpl 
processChild
INFO: Child: /osgi/service_registry/...

****************  
notifyListeners({endpoint.framework.uuid=80ddda84-0357-0011-1dd6-a9aea21915ce, 
endpoint.id=...},  false)

[Start Level Event Dispatcher] INFO 
org.ops4j.pax.web.service.internal.Activator - Pax Web started
[Framework Event Dispatcher] DEBUG org.ops4j.pax.web.pax-web-jetty-bundle - 
BundleEvent STARTED

Sorry, no idea :-). If I were to find the solution, then I'd probably
get the Karaf source and see how the logging gets centralized there, as
it appears to be a container-level issue, how to make sure the Log
manager intercepting all the log requests is installed and set up...

Cheers, Sergey

Thanks in advance,
Sven





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to