Hi all,
I'm trying to use logging for debugging purposes from ScriptRunner in Confluence.
In the ScriptConsole, I set the imports and calling log info as below
however it doesn't print out any log. I tried to use log.debug, log.error and so on
but nothing works.
import com.atlassian.confluence.security.login.LoginManager
import com.atlassian.confluence.user.UserAccessor
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.user.GroupManager
import java.time.LocalDateTime
import java.time.ZoneId
log.info "test message"
I searched then found there is a way to use custom logs but I'm not sure how I can use it.
If you can provide an example of how to use it, it would be very helpful.
Thank you.
Jaesang Kim
Community moderators have prevented the ability to post new answers.
import org.apache.log4j.Loggerimport org.apache.log4j.Level
def log = Logger.getLogger("com.acme.CreateSubtask")log.setLevel(Level.DEBUG)
log.debug "foo bar"
This will be enough to get your logging working. and was taken from this page: https://www.adaptavist.com/doco/display/SFJ/Set%2Blogging%2Bto%2Bhelp%2Bdebug%2Byour%2Bscripts
Thank you Will C for the comment but it seems not working for me.
It reads 'No such property : Log for Class : org.apache.log4j.Logger'
I'm trying this from confluence but not from JIRA. The reference you sent me probably work for jira but not in confluence? Thank you again for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bit late, but in case anyone gets here like I did.
Seems like all you need is these lines:
import org.apache.log4j.Level
log.setLevel(Level.DEBUG)
log.info("foo bar")
At least for Jira DC v9.4.23 and Scriptrunner v8.30.0
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.