You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Millies, Sebastian" <Se...@ids-scheer.com> on 2010/09/10 11:43:18 UTC

Distributed Logging with SCA and Log4J

Hello there,

what are your thoughts on distributed logging with SCA services?

To me, the obvious approach would be to use the Log4J JMSAppender,
create a JMS provider with a loggingTopic, and write my own 
Log4JJMSMessageListener (modelled on org.apache.log4j.net.JMSSink)
to persist the messages whenever one is ready to be consumed. (Perhaps
I would also write my own JMSQueueAppender, because using point-to-point
instead of pub/sub would seem more logical to me when logging).

The above would probably work, but it would not involve SCA at all. How then
would one go about creating an SCA component that offers a logging service
and can be used in conjunction with an established logging framework like
Log4J? 

Would I perhaps do the following:

a) define an SCAAppender by extending org.apache.log4j.AppenderSkeleton
b) provide a LoggingService interface with an append(LoggingEvent) method 
c) make LoggingService available over an SCA binding (e. g. JMS)
d) wrap my SCAAppender in a composite XML file and give it a reference 
   to LoggingService
e) in SCAAppender.append() delegate to loggingServiceRef.append()
f) implement interface org.apache.log4j.spi.LoggerFactory in my own 
   SCALoggerFactory class to obtain an instance of the SCAAppender service 
   from the SCA domain
g) create all Logger instances in my services through calls of
   Logger.getLogger(String, new SCALoggerFactory(String))

Does this even make sense in your view, or would it be needlessly roundabout?

-- Sebastian