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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,559,980
Community Members
 
Community Events
185
Community Groups

Scriptrunner Behaviour not writing logs?

Edited

'm using the latest version of both Jira Service Desk Server and Scriptrunner.

I can write to the log file in the Scriptrunner console with

log.info("Test")

but when I put this in a behaviour initialiser it does not write to the same log file. Shouldn't it write to the log every time the request form is loaded?

 

Capture.PNG

2 answers

1 accepted

1 vote
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 07, 2020

It writes to the same file... 

Here are 3 examples with the same 3 lines of code:

log.info "info"
log.debug "debug"
log.error "error"

In the console:

[...] url:/rest/scriptrunner/latest/user/exec/ username:p6s INFO p6s 916x226878x1 1latest/user/exec/ [c.o.scriptrunner.runner.ScriptBindingsManager] info
[...] url:/rest/scriptrunner/latest/user/exec/ username:p6s ERROR p6s 916x226878x1 /latest/user/exec/ [c.o.scriptrunner.runner.ScriptBindingsManager] error

In a behavior initializer (jira mapping)

[...] url:/rest/scriptrun...lidatorsByPid.json username:p6s INFO p6s 916x226866x1 1behaviours/latest/validatorsByPid.json [c.o.scriptrunner.runner.ScriptBindingsManager] info
[...] url:/rest/scriptrun...lidatorsByPid.json username:p6s ERROR p6s 916x226866x1 /behaviours/latest/validatorsByPid.json [c.o.scriptrunner.runner.ScriptBindingsManager] error 

In a behavior initializer (jsd mapping)

[...] url:/rest/scriptrun...lidatorsByPid.json username:p6s INFO p6s 919x227023x1 1behaviours/latest/jsd/jsd/validatorsByPid.json [c.o.scriptrunner.runner.ScriptBindingsManager] info
[...] url:/rest/scriptrun...lidatorsByPid.json username:p6s ERROR p6s 919x227023x1 /behaviours/latest/jsd/jsd/validatorsByPid.json [c.o.scriptrunner.runner.ScriptBindingsManager] error

All 3 log extracts came from atlassian-jira.log. I removed the date/time etc to keep the lines shorter.

Notice that the "debug" statements were not printed. That's because my log level for com.onresolve.scriptrunner.runner.ScriptBindingsManager is set to INFO. You can change from Loggin and Profiling.

Or using code:

log.setLevel(org.apache.log4j.Level.DEBUG)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events