Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,235
Community Members
 
Community Events
168
Community Groups

ScriptRunner Console Logging Level?

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

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. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

3,493 views 3 10
Read article

Atlassian Community Events