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 Sniffy Agent parameter Description Default Value

-Dio.sniffy.monitorJdbc

IO_SNIFFY_MONITOR_JDBC

N/A

Monitor JDBC

true

-Dio.sniffy.monitorSocket

IO_SNIFFY_MONITOR_SOCKET

N/A

Monitor socket connections

false (enabled implicitly by Sniffy javaagent or SniffyFiler)

-Dio.sniffy.monitorNio

IO_SNIFFY_MONITOR_NIO

monitorNio

Monitor NIO socket connections

false (enabled implicitly by Sniffy javaagent or SniffyFiler)

-Dio.sniffy.topSqlCapacity

IO_SNIFFY_TOP_SQL_CAPACITY

N/A

Maximum number of top SQL queries to store

1024

-Dio.sniffy.filterEnabled

IO_SNIFFY_FILTER_ENABLED

N/A

Enable servlet filter

true

-Dio.sniffy.excludePattern

IO_SNIFFY_EXCLUDE_PATTERN

N/A

Regexp for excluding sniffy completely from certain servlet requests

-Dio.sniffy.injectHtml

IO_SNIFFY_INJECT_HTML

N/A

Inject Sniffy HTML to result HTML

true

-Dio.sniffy.injectHtmlExcludePattern

IO_SNIFFY_INJECT_HTML_EXCLUDE_PATTERN

N/A

Regexp for excluding sniffy widget from certain servlet requests

N/A

N/A

sniffyPort

HTTP port Sniffy Agent is listening on

5555

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.

Convenient Sniffy Chrome Extension can add these headers by simply clicking on an icon in your Google Chrome browser.