question

infinibit avatar image
0 Likes"
infinibit asked ·

How to disable exception logging in eBay SDK? (disable entries to the log.txt file)

I have an asynchronous program written for Winforms using the .Net SDK and came up with a problem when making API calls (one right after another). The problem is contention with the Log.txt file that the SDK writes to - I get the error: "System.IO.IOException: The process cannot access the file ' Log.txt' because it is being used by another process" If the calls are too close together (which is unavoidable due to the asynchronous nature of my program), the log.txt file remains locked. I'm making 2 eBay Official Time calls (1 call per store and I have 2 different stores). How can I disable the SDK logging (at least temporarily)? Public Shared Function IsServiceActive(QBAccount As QBCommon.account) As Boolean Dim retVal As Boolean = False Try SetApiContext(QBAccount) Dim apicall As GeteBayOfficialTimeCall = New GeteBayOfficialTimeCall(Context) apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll) Dim eBayOfficialTime As Date = apicall.GeteBayOfficialTime() Dim apiResponse As GeteBayOfficialTimeResponseType = apicall.ApiResponse If apiResponse.Ack = AckCodeType.Success Then retVal = True Else Throw New Exception(apicall.ApiException.Message) End If Catch ex As Exception AppLogging.WriteEventToMemory(EventLevel.Fatal, ex.ToString, "IsServiceActive") retVal = False End Try Return retVal End Function From the code snippet, when the API call is made GeteBayOfficialTime() an entry is added to the log.txt file in the \Bin\ folder that looks like so: "[10/7/2016 12:58:11 PM, Informational] https://api.ebay.com/wsapi?callname=GeteBayOfficialTime&siteid=0&client=netsoap"; The very next call will cause the System,IO,IOException error I have no idea where to look to prevent logging to this file. Any ideas?
apisdkdotnet-ebay-api
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
infinibit avatar image
0 Likes"
infinibit answered ·
I found the answer: Set EnableLogging property of the ApiLogManager to False. Context = New ApiContext() Context.ApiLogManager = New ApiLogManager() Context.ApiLogManager.ApiLoggerList.Add(New FileLogger(My.Settings.EbayAPI_LogFileName, True, True, True)) **Context.ApiLogManager.EnableLogging = False** Context.Site = eBay.Service.Core.Soap.SiteCodeType.US Context.Timeout = My.Settings.EbayAPI_TimeOut
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.