[Apiman-user] policy error/failure writer cannot find logger
Marc Savy
marc.savy at redhat.com
Thu Aug 31 07:35:31 EDT 2017
Hi Balu,
The Apiman Gateway does not have any support for injection. That's
only on the Apiman Manager side, I'm afraid (for performance reasons).
I understand the lack of easy logging availability in these components
is a point of frustration, and we will look to address that in a
future release.
A temporary workaround is to just directly use your logger of choice for now.
Regards,
Marc
On 28 August 2017 at 14:05, Balu S <sbalu27 at gmail.com> wrote:
> Hello,
>
> I have a custom error and failure writers that implements IPolicyErrorWriter
> and IPolicyFailureWriter respectively. But these implementation methods does
> not provide IPolicyContext object to access loggers. However this is
> possible from IDataPolicy.
>
> So I have tried to inject the ApimanLogger like below, but it always yields
> null. I have include the neccesary jar as "provided" scope in pom.xml.
>
>
> example:
> public class MyPolicyErrorWriter implements IPolicyErrorWriter{
>
> @Inject @ApimanLogger(MyPolicyErrorWriter.class)
> IApimanLogger logger;
>
> @Override
> public void write(ApiRequest request, Throwable error,
> IApiClientResponse response) {
>
> // here logger is always null?
> logger.info("
> }
> ......
>
> Could you please suggest how can I add IApimanLogger to my custom error or
> failure writers ?
>
> Best regards
> Balu
>
> _______________________________________________
> Apiman-user mailing list
> Apiman-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/apiman-user
>
More information about the Apiman-user
mailing list