SmartObject runtime logging
You can enable detailed logging for SmartObjects to help with SmartObject runtime debugging. To set up runtime logging for SmartObjects, edit the file K2HostServer.exe.Config file located in "%PROGRAMFILES%\K2\Host Server\Bin". Then configure the <logging> section for the log files you want to output.
By default, all the log files are disabled. Change the log="no" setting to log="yes" for each log file you want to create. Restart the product service to pick up the configuration changes, execute the SmartObject method and then review the log files' output. By default, the log files are written to "%PROGRAMFILES%\K2\ServiceBroker\logs"
To turn on the detailed logging, follow the steps below:
- Browse to and open the following file in a text editor: "%ProgramFiles%\K2\Host Server\Bin\K2HostServer.exe.config" then find the <logging> section as in the code block below.
- By default, all the log files are disabled. Change the log="no" setting to log="yes" for each log file you want to create:
CopyIf log="yes", the overwrite property sets whether the log file is overwritten (overwrite="yes") or appended (overwrite="no") every time a SmartObject is executed. This might produce unexpected results, for example, when a complex SmartObject executes multiple methods, only the last one is logged. We recommend leaving overwrite set to no.
Set log="yes"
<logging>
<serviceauthentication log="no" path="C:\Program Files\K2\ServiceBroker\Logs\serviceauth.log" overwrite="no" />
<timestamping log="no" path="C:\Program Files\K2\ServiceBroker\Logs\timestamp.log" overwrite="no" />
<brokerpackagein log="no" path="C:\Program Files\K2\ServiceBroker\Logs\brokerpackagein.log" overwrite="no" />
<brokerpackageout log="no" path="C:\Program Files\K2\ServiceBroker\Logs\brokerpackageout.log" overwrite="no" />
<servicepackagein log="no" path="C:\Program Files\K2\ServiceBroker\Logs\servicepackagein.log" overwrite="no" />
<servicepackageout log="no" path="C:\Program Files\K2\ServiceBroker\Logs\servicepackageout.log" overwrite="no" />
</logging>
There are six different log files:File Name Logged Information serviceauth.log Shows the security credentials used when the service was executed. Check the current thread user to see which user account executed the service broker code. timestamp.log brokerpackagein.log Logs the SmartObject that called the broker and the method of the SmartObject that uses the Broker. Use this information to see which SmartObject and method were executed, and when. brokerpackageout.log This data can be useful when you need to troubleshoot why only some and not all the expected records were returned to the UI. For example, if the brokerpackage log reports the expected and correct number of records, perhaps the UI is filtering out data after the broker returned the right number of records. servicepackagein.log Represents the Service Instance configuration. The service objects for the service instance called, with their methods, properties, and the mappings that define how the provider types mapped to service object types. When troubleshooting, one of the most useful values is the <serviceauthentication> section, where you can see the user account context that used to query the provider. servicepackageout.log Is the raw data returned by the Service Instance. This information can be useful when the data shown in the UI does not match the data you were expecting. Check this log file to see if the expected data was returned to the SmartObject, in which case the problem is likely on the UI side. - Save your changes to the config file.
- Restart the product service to pick up the configuration changes.
- Execute the SmartObject method and then review the log files' output. By default, the log files are written to "%PROGRAMFILES%\K2\ServiceBroker\logs" (the path attribute for each setting).