Is it possible to change the location of the logfile created by custom scripts? I tried the following code without success:
import org.apache.log4j.Level
import org.apache.log4j.Logger
import org.apache.log4j.SimpleLayout
import org.apache.log4j.FileAppender
log.removeAllAppenders()
log.addAppender(new FileAppender(new SimpleLayout(),"qweasd.log",false))
log.setLevel(Level.DEBUG)
log.error("Test")
I know that the docs mention that you can define a custom FileAppender in something.properties, but I need a way to do this at runtime. If it makes any difference, I tested this snippet using the script console of a local instance of Jira provided by the ScriptRunner sample application. Also, I am aware that it is possible to just create a File and write to that, but I'd very much prefer the comfort of log4j.
The code I posted actually works. The issue was that scriptrunner-samples comes with a broken script-root-config which leads to the new log (and I suppose any other file you'd create as well) being created in
scriptrunner-samples\jira\target\container\tomcat8x\cargo-jira-home
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.