Reply
Member
Posts: 3
Registered: ‎08-28-2019
Accepted Solution

Disable debug messages C# SDK

[ Edited ]

There are a number of log messages generated from the C# SDK when I do any number of operations against the library. An example of some are:

  1. Setting response: 'AuthorizeNet.Api.Contracts.V1.getHostedPaymentPageResponse'
  2. Response obtained: AuthorizeNet.Api.Contracts.V1.getHostedPaymentPageResponse

  3. Retreiving Response from Url: 'https://apitest.authorize.net/xml/v1/request.api'

  4. Creating PostRequest Url: 'https://apitest.authorize.net/xml/v1/request.api'

  5. Etc.

The application also uses the system.diagnostics for other debugging purposes and that cannot just be removed from the web.config (the web.config code within the BEGIN/END LEGACY is what is previously used). I updated the web.config to use the code within the BEGIN/END NEW CODE sections, but I still get the verbose logging messages.

 

Any suggestions? We still need the other logging to work but would like to disable the Authorize.NET logging. I'm open to custom code implementations as well.

 

<system.diagnostics>
    <!-- BEGIN LEGACY -->
    <trace autoflush="true" indentsize="4">
        <listeners>
            <clear/>
            <add name="emailAdminListener" type="SolutionNamespace.TraceListeners.EmailToAdminTraceListener,SolutionNamespace,Version=1.0.0.0,Culture=neutral,PublicKeyToken=6986"/>
            <add name="logToDBListener" type="SolutionNamespace.TraceListeners.LogToDatabaseTraceListener,SolutionNamespace,Version=1.0.0.0,Culture=neutral,PublicKeyToken=6986"/>
        </listeners>
    </trace>
    <!-- END LEGACY -->

    <!-- BEGIN NEW CODE -->
    <sources>
        <source name="AnetDotNetSdkTrace"
switchName="sourceSwitch"
switchType="System.Diagnostics.SourceSwitch" propagateActivity="true">
            <listeners>
                <add name="emailAdminListener" type="SolutionNamespace.TraceListeners.EmailToAdminTraceListener,SolutionNamespace,Version=1.0.0.0,Culture=neutral,PublicKeyToken=6986"/>
                <add name="logToDBListener" type="SolutionNamespace.TraceListeners.LogToDatabaseTraceListener,SolutionNamespace,Version=1.0.0.0,Culture=neutral,PublicKeyToken=6986"/>
            </listeners>
        </source>
    </sources>

    <switches>
        <add name="sourceSwitch" value="Error"/> 
    </switches>
    <!-- END NEW CODE -->
</system.diagnostics>

Accepted Solutions
Solution
Accepted by topic author alexcasciani1
‎10-17-2019 05:41 AM
Member
Posts: 3
Registered: ‎08-28-2019

Re: Disable debug messages C# SDK

After some debugging I found the problem. The issue is that I have to use an older SDK version because all newer versions of the SDK have a bug that has yet to be fixed by AuthorizeNet. Unfortunately, the version I am using does not specify a TraceSource in the LogHelper.cs class. In newer versions "AnetDotNetSdkTrace" is the specified TraceSource. Because no TraceSource is specified in the older version, the default trace listeners are used. The solution is to build the source code from the older version and modify LogHelper.cs to specify a TraceSource (specifically AnetDotNetSdkTrace).

View solution in original post


All Replies
Highlighted
Member
Posts: 4
Registered: ‎09-24-2019

Re: Disable debug messages C# SDK

Provides a set of methods and properties that help debug your code. ... NET API Browser · System. ... You can customize the tracing output's target by adding TraceListener instances to or removing instances from the Listeners collection. ... In Visual Studio C# and Visual Basic projects, by default, the "DEBUG" conditional ...... 192.168.1.1

Solution
Accepted by topic author alexcasciani1
‎10-17-2019 05:41 AM
Member
Posts: 3
Registered: ‎08-28-2019

Re: Disable debug messages C# SDK

After some debugging I found the problem. The issue is that I have to use an older SDK version because all newer versions of the SDK have a bug that has yet to be fixed by AuthorizeNet. Unfortunately, the version I am using does not specify a TraceSource in the LogHelper.cs class. In newer versions "AnetDotNetSdkTrace" is the specified TraceSource. Because no TraceSource is specified in the older version, the default trace listeners are used. The solution is to build the source code from the older version and modify LogHelper.cs to specify a TraceSource (specifically AnetDotNetSdkTrace).

Member
Posts: 1
Registered: ‎10-21-2019

Re: Disable debug messages C# SDK

A twelve-factor app never concerns itself with routing or storage of its output stream yourtexasbenefits.