Advanced Filtering
Logging at Debug, Debug Verbose, or All levels can result in very large log files that could be challenging to analyze, while many of the trace messages may be unrelated to the specific functionality you want to diagnose. You can apply TraceWorX module filtering and custom filtering to narrow down which trace messages get logged. Although the TraceWorX Log Viewer can filter out unrelated logged messages when viewing a TraceWorX log file, filtering such unrelated messages before even logging them to the file can help keep the system performance running smoothly by lowering the amount of diagnostic data that needs to be written to disk.
Module Filtering is the ability to specify that only certain components in an application should be logged.
The module filter is a list of DLL names (filename without the .dll extension) and trace levels for each DLL. If the “calling assembly” of trace call is in the filter table, the configured trace level for that assembly is used; otherwise, it uses the trace level defined for the application. This means that by default, all DLLs in an application inherit the trace level defined for the application, but you can provide per-DLL trace level overrides using the Module Filter.
That essentially allows you to configure either an include or exclude list of assemblies to log. If you set the application’s trace level to None, you could add items to the module filter to include only certain assemblies for tracing. Alternatively, you could configure the application’s trace level to something other than None, and add assemblies to the filter with trace level set as None to exclude certain assemblies from tracing.
There is also a toggle option to enable/disable handling of the Module Filter. This allows you to configure a complex module filter list and then quickly switch it off and on without losing the configuration. The default value for this option is Off.
Custom Filtering is the ability to specify that messages with a certain filter name should or should not be logged. For example, this feature could be used to log messages about a specific datasource name (i.e. tagname).
The Custom Filter list is similar to the Module Filter list, but there are more options for how this list is applied. The Custom Filter is a list of strings (“filter names”) and trace levels – the filter names can be anything, but one of the primary uses would be to specify datasource names.
There are several ways that the custom filter list can be applied for tracing:
| Custom Filter Option | Effect |
|---|---|
| Disabled | Trace messages that specify a custom filter are not logged. This is the default value. |
| Log custom messages if module is logged | Trace messages that specify a custom filter are logged if they match an item configured in the custom filter list, and if the message would be logged based on the trace level configured for the application/module. This option, for example, allows the user to log custom filtered messages only for specific modules. |
| Log custom messages only | Trace messages that specify a custom filter are logged if they match an item configured in the custom filter list. Trace message that do not specify a custom filter are not logged, regardless of the trace level configured for the application/module. This option allows the user to log only those messages that match a custom filter, excluding all other trace messages. |
| Log custom messages and module messages | Trace messages that specify a custom filter are logged if they match an item configured in the custom filter list. Trace message that do not specify a custom filter are also logged based on the trace level configured for the application/module. This option allows the user to log messages that match a custom filter, in addition to other non-custom trace messages. |
| Log all custom messages if module is logged | Trace messages that specify a custom filter are logged if the message would be logged based on the trace level configured for the application/module. The configured custom filter is not used (the messages are logged regardless of whether or not they match the configured custom filter). Use caution when selecting this option since it could cause an excessive number of trace messages to be logged. |