Skip to main content
Published: February 21 2008, 2:30:00 PMUpdated: August 04 2022, 9:31:18 PM

I want to go live with my application in production and I want to enable logging only certain calls to reduce overhead.  How can I do that with the .NET SDK?


If you do not want to log all the requests and responses, then you can use the SoapRequest and SoapResponse properties of the API call object to get the call request and response and log it to a file.

Detailed Description

Here is a C# sample that logs the request and response for GeteBayOfficialTime:


using  System;
using System.IO;
using eBay.Service.Call;
using eBay.Service.Util;
using eBay.Service.Core.Sdk;
using eBay.Service.Core.Soap;

private void GeteBayOfficialTime()

     ApiContext context = new ApiContext();
     context.ApiCredential.eBayToken = "Your Token";
     //Server URL for Sandbox
context.SoapApiServerUrl = "";
     //For production, the url is"

GeteBayOfficialTimeCall call = new GeteBayOfficialTimeCall(context);
     FileStream fileStream = null;
     StreamWriter writer = null;
     string fileName = "log.txt";
     fileStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);

     writer = new StreamWriter(fileStream);
     writer.BaseStream.Seek(0, SeekOrigin.End);
     //log request
writer.WriteLine(call.SoapRequest + "\r\n");
     //log response



How well did this answer your question?
Answers others found helpful