Adding content to every log call

Enonic version: 6.11.1
OS: Windows 8.1

We need a piece of info included in every log message made in the server side js-files in our project. Is there a way to do that without having to change the content of the log.debug() calls or replace all the calls with a custom logger?

Is there a way to customize the included logger?

XP uses Logback for the logging. You can try to configure it. See documentation here. It has some filtering options.

To override the config copy your modified file to XP_HOME/config/logback.xml
The default config is in the install directory, in home/config/logback.xml .

But I think it might be easier to just create your own library for logging, that wraps over log.xxx() and adds the extra info.

3 Likes

This topic was automatically closed after 24 hours. New replies are no longer allowed.