How to set log4j logging level

I’m using logging in my groovy code to try and debug it, and though it would be helpful to make use of the DEBUG log level, so that i can enable it on a test environment and disable on prod.

What’s the best way to set the logging level for a collection or whole environment? I tried editing this file to “ALL”:
$SEARCH_HOME/web/conf/modernui/log4j.properties (Hook scripts - Funnelback Documentation - Version 15.12.0) but it doesn’t seem to have made a difference.

Hmm maybe I should try this? https://docs.funnelback.com/more/extra/groovy_filters.html#logging
But I don’t know how to do some of those things, a code example would be helpful.

Otherwise should I just call setLevel, perhaps from a custom collection.cfg setting? Redirect Notice

Hi David,

It really depends on what you are trying to debug.

Changing the log level for some things is quite easy (like for crawling and filtering), others are not (logging for debugging templates and hook scripts).

The easiest approach for debugging your hook scripts and templates is probably to print to log.error as these will get printed in the modern UI logs at the default log level - but you must remember to remove these prints from your code once you’ve finished testing otherwise your modern UI logs will forever be writing out messages which could consume a lot of disk space.

Thanks Peter, yes I left a bit of context out. I was working on a Groovy script, and using logger.info() to output lots of info for debugging purposes. I was hoping to use logger.debug(), and use the debug log level temporarily. And I was hoping to find a way to control the whole collection at once. But couldn’t find an easy way to do this so have not bothered to pursue.

I guess the answer is as you say, it has to be managed separately for different processes. And there’s no built-in config for groovy logging. Oh well, it was worth an ask.