Click or drag to resize

Using logging in a custom adapter

One of the interface members available to all adapter interfaces is a Logger that can be used to create entries in the process log for the ShipExec service. An entry can be made in the process log using the Logger.Log method.

The following log levels are available for process log entries:

  • Fatal
  • Error
  • Warning
  • Info
  • Debug
  • Trace

The default location for all ShipExec log files is \Program Files\UPS Professional Services Inc\ShipExec\Core\logs

Code Examples

Below are several examples of how to create log entries with different levels.

C#
//Example of an info log entry

        if (Logger != null)
            Logger.Log("Adapter", LogLevel.Info, "Database Version is 2.1");


//Example of a trace log entry

        if (Logger != null)
            Logger.Log("Adapter", LogLevel.Trace, "Start ship process" + DateTime.Now.ToString("HH:mm:ss:fffff"));


//Example of an Error log entry

     if (Logger != null)
            Logger.Log("Adapter", LogLevel.Error, "An error occured" + DateTime.Now.ToString("HH:mm:ss:fffff"));