Logging errors

In a Windows LN environment, the database driver logs its error messages in the Windows Application Event Log or in a log file in the %BSE%\log directory. The Application Event Log can be viewed using the Windows Event Viewer.

An alternate location for the message log file can be specified through the environment variable MSQL_DUMP_MESG. Warning messages can be logged to the error log by setting the environment variable MSQL_LOG_WARNINGS. For detailed description of these two environment variables, see Driver resources and environment variables.

Information can be retrieved from these log entries:

  • The user name, date, time, source file, and line number.
  • The function called.
  • The error code returned by the database.
  • The database error description.
  • The BDB error code returned to the application.
  • The failing SQL statement, in some cases.

If a database error occurs, an attempt is made to map it to a known or anticipated error condition. Generally, these mapped (Baan database) BDB errors contain corresponding error numbers in the range of 1 to 1000. If a database specific error occurs, which does not have a corresponding BDB error code, it is mapped to an error code over 1000 with this formula:

abs(error_code) + 1000

For example, if an error -1652 occurs, BDB error 2652 is returned to the application.

In most cases, the log entries from the display driver, the LN application virtual machine, and the database driver contain enough information to determine the nature of and solution to the problem. Whenever an error is encountered with an error code greater than 1000, you must check the log entries from the database driver. All error log entries can be viewed in the Application Log by using the Windows Event Viewer.