Hello,
I'm trying to do some automate some admin work that I need to be very careful with before I do it. I've had much luck with doing some automation with ScriptRunner for Jira Server (SRfJS), so I figured this would be a good thing to try to do with the Bitbucket Server (SRfBS) variant. My problem (well, this specific problem..) is related to logging.
Both versions have an injected log object. In SRfJS, I used log.setLevel(Level.INFO) when I wanted to see INFO-level messages and set the level higher when I didn't. In SRfBS, it seems that WARN is the floor for log4j levels, even when using log.setLevel(Level.ALL). This isn't the end of the world as I can convert my INFO messages to WARN, but it bothers me aesthetically. :D
Am I missing something?
Interesting. It is different to SR4J.
I have tested following snippet in ScriptRunner > Console, you can use Bitbucket's Java API to set the level like so:
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.bitbucket.log.LoggingService
def loggingService = ComponentLocator.getComponent(LoggingService)
loggingService.setLevel("com.onresolve.scriptrunner.runner.ScriptBindingsManager", "INFO")
log.info "SOmethissng"
You can read more about LoggingService class here.
Thank you, Max. I'll keep this in mind the next time that I need to venture into SRfBS scripting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.