Support Spotlight: How to Use the SAP Business One Log Files to Analyze Some Performance Scenarios
A complex system environment can at times lead to a less than optimal performance. A great help in finding what might be causing this can be the log files.
In this blog we will explain how to setup detailed logging in the SAP Business One client and how to collect the necessary log files for troubleshooting. We will also look at some examples of slow performance that can be easily identified and fixed with help of these log files.
Log file settings
To capture more valuable information, such as executed SQL queries you need to setup detailed logging in Help → Support Desk → Logger Settings:
To save the new log file settings please start the SAP Business One Client as an Administrator. This allows write access to the configuration file b1LogConfig.xml located in SAP Business One client installation directory (default path: C:\Program Files\SAP\SAP Business One\Conf).
In all the examples below, we are using detailed logging.
Collecting the log files
Log files are located in directory C:\ProgramData\SAP\SAP Business One\Log\SAP Business One\[WINDOWS USERNAME]\BusinessOne.
The files you need to analyze start with Client.b1logger or DiApi.b1logger (example: Client.b1logger.20221017_140603.pid2528.log.csv).
The log file name also contains a creation timestamp in the format YYYYMMDD_HHMISS and PID (process identifier) of your SAP Business One.exe process. You can verify the PID in the Task Manager or directly in the SAP Business One client via Help → About SAP Business One.
Please note that there might be multiple log files created as once the first log file reaches 5 MB in size, new ones get created.
For some scenarios, such as long running reports, you should consider increasing the Log Folder Max Size parameter in order to prevent automatic log file deletion.
After you have reproduced the scenario, closed your SAP Business One Client, and collected the necessary logs, we recommend disabling detailed logging as it can have a slight performance impact.
You can use the Restore Default Settings button for this purpose.
Three performance scenarios
For the following log file analysis, we are using Notepad++, however, you can use your preferred text editor. If using Microsoft Excel, the TimeStamp column data might be incorrectly converted.
We are also using SDK Help Center to find out more information about SAP Business One tables.
Example 1 – Slow login caused by too many alert messages
If a specific SAP Business One user encounters a slow login, enable detailed logging with a different user as it might save you some time. Detailed logging will be enabled for all users who are using that same SAP Business One client.
As a first step identify the end of the login process in the log file.
- Locate the string User Logging Event: User logged in [B1 username].
- Further down find the performance counter (Component column = Perf) “LOG_BtnProc::LOG_InProc” or in some cases “CMP_OKProc::CMP_InProc”
This will show you the login duration – 30 seconds in this example:
- Scroll up to before the login event.
- Locate the performance counters with suspiciously high duration and long time difference between the timestamps in the log.
In this example you can see that the displaying of Messages/Alerts Overview form (ALPDrawForm) took almost 26 seconds:
- Scroll further up and notice the two long time differences between the timestamps below (12 & 7 seconds).
- Both delays are after SAP Business One client fetched more than 16000 rows from the OAOB (Message Sent) and the OAIB (Received Alerts) tables.
- We can see that the root cause of the slow login is caused by a large number of alert messages.
- To rectify this, we recommend that the user performs a cleanup of their alerts inbox to improve the login process.
Example 2 – Slow performance when adding a Sales Order caused by custom code in SBO_SP_TransactionNotification stored procedure
When troubleshooting any performance problem, we recommend taking note of when the operation started and finished to identify the relevant sections in the log file.
For this specific scenario, we will look for the last GUI operations performed by the user on the Sales Order form and the subsequent start of the add transaction Business Process started: Add:
- After identifying these items in the log, scroll down and look for performance counters with suspiciously high duration and long time difference between the timestamps in the log.
- In the screenshot below we can see a 10 second delay caused by the execution of SBO_SP_TransactionNotification stored procedure.
- To resolve the problem, please optimize the custom code found in the SBO_SP_TransactionNotification stored procedure.
Example 3 – Slow display of Item Master Data caused by invalid attachments path
In this example we will look at a scenario where it takes longer than 22 seconds to display the Item Master Data record for the item TEST_ITEM.
- Our first step is to look for the timestamp when the user pressed the Find button in the SAP Business One Client.
- Alternatively, you can search for the string TEST_ITEM and you will find the exact line and the subsequent start of the return transaction Business Process started: Return:
- Scroll down and look for performance counters with suspiciously high duration and long time difference between the timestamps in the log.
- In this example, we can see a 22 second delay after the 2 queries from OATC (Attachments) and ATC1 (Attachments – Rows) tables:
Remark: select from ATC1… on line 6254 in the log was too long so the table name is not visible on the screenshot.
This indicates that you should review the attachments path defined in the General Settings. The SAP Business One client attempts to access the folder location which causes a delay.
- Verify that the folder is accessible from the client machine, and there are no network issues.
- A common reason is the change in the attachment path after a recent upgrade.
Support Spotlight Series
We hope this read has been informative and beneficial. For more blogs and tips from the SAP Business One Support team, please visit our space on the communities: https://blogs.sap.com/tag/b1-support-spotlight/
For questions about SAP Business One, please submit your question here.