jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <n...@apache.org>
Subject Re: Custom Logging
Date Thu, 22 Nov 2018 00:00:07 GMT
Interesting.

I see it supports Apache HttpClient and OkHttp, and we support both as http
drivers.

Actually, for OkHttp you can provide a custom module that binds your
own OkHttpClientSupplier
[1] implementation and you could initialize it with the logbook interceptor.

Could that be an option?



[1]
https://github.com/jclouds/jclouds/blob/master/drivers/okhttp/src/main/java/org/jclouds/http/okhttp/OkHttpClientSupplier.java


On Thu, Nov 22, 2018, 00:50 John McDonnell <johnmcdonnell@apache.org wrote:

> Hi Ignasi,
>
> Thanks for the reply.
>
> So the requirement we have is that we need to log both the requests and
> the responses to both a database table but also a file.  Additionally we
> would also need to hide passwords in any requests (i.e. if we create an
> account on CloudStack we need to supply a password).
>
> Previously we used a logging module here where by we logged each request
> or response (we did the password hiding here also), into a database table.
> The problem we have with using a class that extends from
> org.jclouds.logging.BaseLogger we couldn't match requests to responses as
> each request or response came in on its own to the logger to be logged.
>
> Ultimately we want to bring more consistency, when reviewing
> request/response logs its very hard to match them up when theres alot of
> traffic (we can communicate with multiple cloudstack instances within a
> short space of time).  I came across logbook recently and was intrigued but
> the more customisation it brings to logging, but was struggling to work out
> how to use something like this with JClouds.  My best guess was to see if
> we could customise the rest client used - to one supported by logbook.
>
> [1]: https://github.com/zalando/logbook
>
> Regards
>
> John
>
> On 2018/11/21 23:10:10, Ignasi Barrera <nacx@apache.org> wrote:
> > Hi John,
> >
> > Can you elaborate a bit?
> > If you use the SLF4j driver with Logback, could you achieve what you need
> > with its Mapped Diagnostic Context [1]?
> >
> >
> > I.
> >
> > [1] https://logback.qos.ch/manual/mdc.html
> >
> >
> > On Wed, 21 Nov 2018 at 23:14, John McDonnell <johnmcdonnell@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > I use JClouds for creating accounts/domains, and retrieving usage on a
> > > CloudStack instance.
> > >
> > > We need to produce better logging where by we can match requests and
> > > responses in a single entry into a DB table.
> > >
> > > From what I can see a custom logging module wouldn't quite work as it
> > > implements org.jclouds.logging.BaseLogger which only supports
> customising
> > > the "standard" log<level> methods.
> > >
> > > I'm looking for an alternative, can we change the rest client used by
> > > JClouds?
> > >
> > > Regards
> > >
> > > John
> > >
> >
>

Mime
View raw message