Multi-Patterns

It is very common to have one logging format per log file. However, this is not a hard requirement and it is possible to have multiple logging formats in a single log file.

The PatternParser allows the possibility of multiple conversion patterns, one per line, as can be seen in the screenshot below:

Note that multi-patterns cannot be configured using the Parser Wizard. You must use manual parser configuration instead.

When using multiple conversion patterns, it's important to keep a few things in mind. First, using multiple patterns will always be slower than using a single pattern. This is because the parser will expect a degree of error when parsing the log file and a single log line will often be parsed multiple times.

When using multi-patterns the first pattern which successfully parses the log line will be used. Therefore, it is best to put more generic patterns which match log fields more broadly at the bottom of the pattern list. For example, '%d %m%n' would match most log entries and therefore should be placed near the bottom.

Note that patterns which span mutliple lines, such as those which declare '\n' as part of the static text, are not supported in multi-patterns.

Finally, when using multi-patterns, it is important that the individual patterns are distinct. For example, if you were using two patterns and every log entry could be parsed by either pattern successfully then LogViewPlus will not know which pattern to use. 'Successful' in this case means that the log entry is parsed without error and does not necessarilly mean that data is placed in the correct column.

< >