MssApiService Logging

 

API service logging is a valuable part of identifying errors and exceptions that may occur during requests to MoversSuite services, such as Agent API and Document API. This data is written to the MssApi.log file that resides in the same location as the MssApiService.exe.config file.

 

By default, API logging is turned off.

 

Enable MssApiService Logging

Use the following procedure to turn on MssApiService logging.

 

STEP

DESCRIPTION

1.   

Locate and open the MssApiService.exe.config file. This file resides in the same location that MoversSuite is installed.

2.   

Enable logging by uncommenting the Log4Net settings section by removing the comments from the following lines:

 

REPLACE:

<!--log4net>

...

</log4net-->

 

WITH:

<log4net>

...

</log4net>

 

3.   

Comment out the StmtAppender section to turn off logging for this service.

 

REPLACE:

<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">

...

<appender-ref ref="SmtpAppender" />

 

WITH:

<!--appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">

...

<!--appender-ref ref="SmtpAppender" /-->

 

4.   

Locate the threshold element and set it accordingly to one of the following: ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF (default). We recommend setting this to DEBUG to include the most information.

 

EXAMPLE:

<threshold value="DEBUG"/>

 

5.   

Start/restart the MSSApiService through the Services console (services.msc) and verify that the MssApi.log log file exists and data is recording to it (displays data regarding the starting of the service).

The log file can be viewed using the Notepad.exe application.

 

Below is a sample log4net section within the MssApiService.exe.config file that has logging enabled.

 

<!--log4net settings-->

    <!-- threshold values: "ALL", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "OFF"/-->

    <!-- There are only DEBUG, INFO, WARN and ERROR level logging in this application. -->

    <log4net>

        <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">

           <param name="DatePattern" value="yyyy-MM-dd"/>

           <param name="MaxSizeRollBackups" value="5"/>

           <param name="MaximumFileSize" value="10MB"/>

           <param name="File" value="MssApiLog"/>

           <threshold value="DEBUG"/>

           <layout type="log4net.Layout.PatternLayout">

               <conversionPattern value="%d - %p %t %c - %m%n"/>

           </layout>

        </appender>

        <!--appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">

           <to value="" />

           <from value="" />

           <subject value="MSSAPI Log" />

           <smtpHost value="jaga.MoversSuite.internal" />

           <bufferSize value="100" />

           <lossy value="true" />

           <layout type="log4net.Layout.SimpleLayout">

           </layout>

           <authentication value="Basic" />

           <username value="myUserName" />

           <password value="myPassWord" />

           <evaluator type="log4net.Core.LevelEvaluator">

               <threshold value="OFF"/>

           </evaluator>

           <filter type="log4net.Filter.StringMatchFilter">

               <stringToMatch value="Put a part of the message you want to get emails on here" />

           </filter>

           <filter type="log4net.Filter.DenyAllFilter" />

        </appender-->

        <root>

           <appender-ref ref="RollingFileAppender" />

           <!--appender-ref ref="SmtpAppender" /-->

        </root>

    </log4net>