Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ScriptRunner Console Logging Level?

PeteToscano November 5, 2020

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? 

1 answer

1 accepted

1 vote
Answer accepted
Max Lim _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2021

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.

PeteToscano January 21, 2022

Thank you, Max. I'll keep this in mind the next time that I need to venture into SRfBS scripting. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events