upscaledb gives you the best troubleshooting available – the source code. If you compile upscaledb in Debug mode (i.e. with ./configure --enable-debug), you can always use a debugger to step into the functions.

But there’s another way to get information about upscaledb internals, and this even works in Release mode: the debug messages. They are printed to stderr not only when a upscaledb function encounters a serious error (i.e. when writing to the file, or when opening a file failed), but also when an API function receives invalid parameters. However, the later messages are not shown in Release mode.

But you can overwrite the error handler to catch ALL of the messages and handle them on your own, and then you will also see the low-priority messages. The following Code installs such an error hander:

my_own_error_handler (int level, const char *message) {
  printf (“level %d: %s\n”, level, message);

Then install this handler:

ups_set_errhandler (my_own_error_handler);

If you now call a upscaledb function with an invalid combination of flags or other invalid parameters, you will see a message printed to stdout.