cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: svn commit: r594302 - in /incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor: LoggingInInterceptor.java LoggingOutInterceptor.java
Date Tue, 13 Nov 2007 14:46:58 GMT

I was actually thinking of allowing the interceptors to contain an 
OutputStream (or PrintStream) that if not null, would log to that.   If 
null, log to the logger.

This could open up the possibility of configuring the LoggingFeature to 
log to a separate file or stdout or similar.  May have to sync on the 
stream though which would kind of suck.   Maybe throw the LogMessage on 
an executor or something to log it "when it can".

Dan




On Tuesday 13 November 2007, James Mao wrote:
> Hi Dan,
>
> This is my bad :(
> I just used this function in the test, forgot about the interceptor
> will be mostly called multiple times.
>
> What about register a callback method, and the interceptor call the
> callback method at the end of the handleMessage, and pass in the
> instance of LoggingMessage?
> does it make sense?
>
> Or we can put an Interceptor in the tests, and it's just for the tests
> purpose?
>
> Regards,
> James
>
> > Author: dkulp
> > Date: Mon Nov 12 13:24:56 2007
> > New Revision: 594302
> >
> > URL: http://svn.apache.org/viewvc?rev=594302&view=rev
> > Log:
> > Fix logging interceptors to not store EVERYTHING logged to them and
> > also be thread safe.
> >
> > Modified:
> >    
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingInInterceptor.java
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingOutInterceptor.java
> >
> > Modified:
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingInInterceptor.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/ja
> >va/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=594302&r1
> >=594301&r2=594302&view=diff
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingInInterceptor.java (original) +++
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingInInterceptor.java Mon Nov 12 13:24:56 2007 @@ -37,7 +37,6 @@
> >  public class LoggingInInterceptor extends
> > AbstractPhaseInterceptor<Message> {
> >
> >      private static final Logger LOG =
> > LogUtils.getL7dLogger(LoggingInInterceptor.class); -    private
> > final LoggingMessage buffer = new LoggingMessage("Inbound
> > Message\n----------------------------");
> >
> >      private int limit = 100 * 1024;
> >      private boolean enabled;
> > @@ -56,10 +55,6 @@
> >          this.enabled = b;
> >      }
> >
> > -    public LoggingMessage getBuffer() {
> > -        return this.buffer;
> > -    }
> > -
> >      public void setLimit(int lim) {
> >          limit = lim;
> >      }
> > @@ -75,6 +70,9 @@
> >      }
> >
> >      private void logging(Message message) throws Fault {
> > +        final LoggingMessage buffer = new LoggingMessage("Inbound
> > Message\n----------------------------"); +
> > +
> >          String encoding = (String)message.get(Message.ENCODING);
> >
> >          if (encoding != null) {
> >
> > Modified:
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingOutInterceptor.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/ja
> >va/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=594302&r
> >1=594301&r2=594302&view=diff
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingOutInterceptor.java (original) +++
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor
> >/LoggingOutInterceptor.java Mon Nov 12 13:24:56 2007 @@ -37,7 +37,6
> > @@
> >  public class LoggingOutInterceptor extends AbstractPhaseInterceptor
> > {
> >
> >      private static final Logger LOG =
> > LogUtils.getL7dLogger(LoggingOutInterceptor.class); -    private
> > final LoggingMessage buffer = new LoggingMessage("Outbound
> > Message\n---------------------------");
> >
> >      private int limit = 100 * 1024;
> >      private boolean enabled;
> > @@ -64,10 +63,6 @@
> >          return limit;
> >      }
> >
> > -    public LoggingMessage getBuffer() {
> > -        return this.buffer;
> > -    }
> > -
> >      public void handleMessage(Message message) throws Fault {
> >          final OutputStream os =
> > message.getContent(OutputStream.class); if (os == null) {
> > @@ -89,6 +84,8 @@
> >          }
> >
> >          public void onClose(CachedOutputStream cos) {
> > +            final LoggingMessage buffer = new
> > LoggingMessage("Outbound Message\n---------------------------"); +
> >              if (cos.getTempFile() == null) {
> >                  //buffer.append("Outbound Message:\n");
> >                  if (cos.size() > limit) {



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
View raw message