Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsMaskingEnabled from July 2021 Update causing failures if NLog not setup and/or enableMasking undocumented variable not present #117

Open
xantari opened this issue Sep 8, 2021 · 3 comments

Comments

@xantari
Copy link

xantari commented Sep 8, 2021

Your code doesn't indicate you have to setup NLog anywhere.

When it's not setup the entire nuget fails to load anything. It seems you have to not only setup NLog now, you also have to add a magic undocumented variable (had to search the source code to find it) called "enableMasking" and set it to true or false because your code doesn't do existence checking.

Stack trace when all undocumented variables and NLog setup not performed:

at AuthenticationSdk.util.LogUtility.IsMaskingEnabled(Logger logger)
at CyberSource.Client.ApiClient.CallApi(String path, Method method, Dictionary2 queryParams, Object postBody, Dictionary2 headerParams, Dictionary2 formParams, Dictionary2 fileParams, Dictionary2 pathParams, String contentType) at CyberSource.Api.ReportsApi.SearchReportsWithHttpInfo(Nullable1 startTime, Nullable1 endTime, String timeQueryType, String organizationId, String reportMimeType, String reportFrequency, String reportName, Nullable1 reportDefinitionId, String reportStatus)
at ARRT.Payments.Services.Vendors.CyberSource.CyberSourceGateway.d__1.MoveNext() in C:\TFS\ARRT.All.Projects\ARRT.Payments.Services\Vendors\CyberSource\CyberSourceGateway.cs:line 65

@wrightsonm
Copy link

Another NLog issue to be aware of is this:

AuthenticationSdk.util.LogUtility expects "file" target to be set in NLog
if FileTarget "file" is not set the AuthenticationSDK will disable logging
which will disable logging for our entire application, not just cybersource

This is our workaround:

            if (!NLog.LogManager.Configuration.AllTargets.Any((t) => string.Equals(t.Name,"file")))
            {
                var fileTarget = new NLog.Targets.FileTarget("file") { FileName = "file.log" };
                NLog.LogManager.Configuration.AddTarget("file", fileTarget);
            }

@xantari
Copy link
Author

xantari commented Sep 20, 2021

That's crazy, didn't know that. Definitely shouldn't be expected behavior.

@wrightsonm
Copy link

NLog.LogManager.Configuration.Variables.Add("enableMasking", new NLog.Layouts.SimpleLayout("true"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants