The Logging Tooltip extension can be customised using a ConcordionExtensionFactory to restrict the log output to named loggers, and by logging level. The output of logging to the console can also be enabled.
Given the LoggingTooltipExtensionFactory has been restricted to use only the foo
logger,
and the system property concordion.extensions
is set to the class spec.concordion.ext.loggingTooltip.LoggingTooltipExtensionFactory
.
When running
<p concordion:assertEquals="getName()">Frank</p>
with a fixture that logs "Hello Foo" to the foo
logger, and "Hello Bar" to the bar
logger,
the logging tooltip displays:
[timestamp]: Hello Foo
Given the LoggingTooltipExtensionFactory has been restricted to use the baz, foo
loggers,
and the system property concordion.extensions
is set to the class spec.concordion.ext.loggingTooltip.LoggingTooltipExtensionFactory
.
When running
<p concordion:assertEquals="getName()">Frank</p>
with a fixture that logs "Hello Foo" to the foo
logger, "Hello Bar" to the bar
logger, and "Hello Baz" to the baz
logger,
the logging tooltip displays:
[timestamp]: Hello Foo [timestamp]: Hello Baz
Given the LoggingTooltipExtensionFactory has been restricted to use the INFO
log level,
and the system property concordion.extensions
is set to the class spec.concordion.ext.loggingTooltip.LoggingTooltipExtensionFactory
.
When running
<p concordion:execute="logStuff()"/>
with a fixture that logs "Hello Info" at the INFO
log level, "Hello Fine" to the FINE
log level, and "Hello Warn" to the WARN
log level,
the logging tooltip displays:
[timestamp]: Hello Info [timestamp]: Hello Warn
For those not using java.util.logging, a custom LogMessenger can be provided. For the sake of the below example, the implementation is one that returns a fixed string, but alternatives that use Logback, log4j or slf4j can be easily implemented as an exercise for the reader.
Given the AlternateLoggingTooltipExtensionFactory has been told to return Hello AlternateLoggingTooltipExtensionFactory
as a log message,
and the system property concordion.extensions
is set to the class spec.concordion.ext.loggingTooltip.AlternateLoggingTooltipExtensionFactory
.
When running
<p concordion:execute="logStuff()"/>
the logging tooltip displays:
[10:25:28.290]: Hello Info[timestamp]: Hello AlternateLoggingTooltipExtensionFactory