Sniffy can be configured globally using Java system properties or environment variables. This configuration can be overriden in web.xml and/or @EnableSniffy annotation - see appropriate sections of documentation.

Warning
sniffy configuration is parsed only once and any changes made to system properties or environment variables in run-time won’t have any effect on Sniffy
Table 1. Table Configuration properties
System Property Environment Variable Description Default Value

-Dio.sniffy.monitorJdbc

IO_SNIFFY_MONITOR_JDBC

Monitor JDBC

true

-Dio.sniffy.monitorSocket

IO_SNIFFY_MONITOR_SOCKET

Monitor socket connections

true

-Dio.sniffy.topSqlCapacity

IO_SNIFFY_TOP_SQL_CAPACITY

Maximum number of top SQL queries to store

1024

-Dio.sniffy.filterEnabled

IO_SNIFFY_FILTER_ENABLED

Enable servlet filter

true

-Dio.sniffy.excludePattern

IO_SNIFFY_EXCLUDE_PATTERN

Regexp for excluding sniffy completely from certain servlet requests

-Dio.sniffy.injectHtml

IO_SNIFFY_INJECT_HTML

Inject Sniffy HTML to result HTML

true

-Dio.sniffy.injectHtmlExcludePattern

IO_SNIFFY_INJECT_HTML_EXCLUDE_PATTERN

Regexp for excluding sniffy widget from certain servlet requests

Sniffy filter can also be enabled or disabled using HTTP query parameters and/or HTTP headers.

If Sniffy filter is currently disabled you can enable it by adding ?sniffy=true query parameter to your request - it will enable the sniffy for current request and will also set a sniffy cookie which will enable sniffy on subsequent requests.

For stateless clients who don’t maintain the cookie jar it might be more convenient to enable/disable Sniffy using Sniffy-Enabled: true / Sniffy-Enabled: false headers. Unlike the query parameter the HTTP header will only affect a single request.

A similar header Sniffy-Inject-Html-Enabled can be used for hiding or showing the Sniffy Widget in the browser. Unlike Sniffy-Enabled It doesn’t come with a query parameter alternative.