Project

Profile

Help

Redirecting output to logger

Added by Yevgeniy Yanavichus over 3 years ago

Is there any way to redirect output to custom logger when using s9api? When talking output I mean the same thing as:

processor.setConfigurationProperty(Feature.STANDARD_ERROR_OUTPUT_FILE, "log.txt");

In this particular case I want to redirect it to SpringBoot's logger - Logback


Replies (3)

Please register to reply

RE: Redirecting output to logger - Added by Michael Kay over 3 years ago

In theory, configuration.setLogger() is designed to meet this requirement.

However, it's not working too well: see bug #4761.

I've been doing quite a bit of work in the last few days to fix this, hopefully this will find its way into the next maintenance release.

RE: Redirecting output to logger - Added by Michael Kay over 3 years ago

I've now committed the fix for bug #4761 to the Saxon 10 branch, so it will appear in the next maintenance release, which if all goes well should be in the next few days.

The effect of this fix is that you can write an implementation of the Saxon net..sf.saxon.lib.Logger interface that forwards messages to the Logger of your choice, and the vast majority of Saxon's messages will be sent to this Logger. This includes progress messages, information and warning messages, xsl:message and fn:trace() output, and the output of standard (default) ErrorListeners - but not custom error listeners unless they choose to use this mechanism.

Another effect of this fix is that processor.setConfigurationProperty(Feature.STANDARD_ERROR_OUTPUT_FILE) only affects the destination of messages written via the configuration's Loggerif the thatLoggerextends Saxon'sStandardLogger`.

RE: Redirecting output to logger - Added by Yevgeniy Yanavichus over 3 years ago

Thanks a lot! We'll try this approach

    (1-3/3)

    Please register to reply