Debugging search template errors

Error logging

Funnelback logs user interface issues to the modernui log. These are accessible via the log viewer from the collection log files for the search package. The relevant log files are:

  • modernui.Public.log: contains errors for searches made against the public HTTP and HTTPS ports.

  • modernui.Admin.log: contains errors for searches made against the administration HTTPS port.

See: Modern UI logging for more information on the modern UI logging, and also for information on how to increase the modern UI log level.

Funnelback also includes some settings that allow this behaviour to be modified so that some errors can be returned as comments within the (templated) web page returned by Funnelback.

The following configuration options can be set on a collection’s configuration while you are working on template changes:


The error format can also be set to return as HTML or JSON comments.

The string error format will return the error as raw text, which results in the error message being rendered (albeit unformatted) when you view the page - this is the recommended option to choose while working on a HTML template as the errors are not hidden from view.

Setting these causes the template execution to continue but return an error message within the code.

Syntax errors in the template resulting in a 500 error are not returned to the user interface - the browser will return an error page.

Data model log object

The data model includes a log object that can be accessed within the Freemarker template allowing custom debug messages to be printed to the modern UI logs.

The log object is accessed as a Freemarker variable and contains methods for different log levels. The parameter passed to the object must be a string.

The default log level used by the modern UI is INFO. It is not possible to change this on a per-collection level and changing the level globally requires administrative access.

This means when debugging your templates you will probably need to print to the INFO level - but don’t forget to remove your logging once you have completed your testing otherwise a lot of debugging information will be written to the log files for every single query. e.g.

<#-- print the query out at the INFO log level -->
${"The query is: "+question.query)}
<#-- print the detected origin out at the DEBUG log level -->
${Log.debug("Geospatial searches are relative to:  "+question.additionalParameters["origin"]?join(","))}
Messages written via the log object will only be logged when accessing the search.html endpoint.