User Tools

Site Tools


logging

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
logging [2018/01/12 09:22] – [ScriptRunner Logging] pawellogging [2026/02/01 12:29] (current) – external edit 127.0.0.1
Line 11: Line 11:
      
 log.debug("foo bar"+myVariable) log.debug("foo bar"+myVariable)
 +</code>
 +
 +==== ScriptRunner Console script to ping a server ====
 +If you want to run a query to ping a server, or IP address, you can use the following script replacing 8.8.4.4 with the server ip or name that you're interested in:
 +<code java>
 +import org.apache.log4j.Logger
 +import org.apache.log4j.Level
 + 
 +def log = Logger.getLogger("com.acme.CreateSubtask")
 +log.setLevel(Level.DEBUG)
 + 
 +
 +def proc = 'ping -c 3 8.8.4.4'.execute()
 +proc.waitFor()
 +def output = proc.text
 +println "Ping ${proc.exitValue() == 0 ? 'OK' : 'NOT OK'}"
 +
 +log.debug("Ping output: "+output)
 </code> </code>
  
Line 18: Line 36:
 import com.onresolve.scriptrunner.runner.util.UserMessageUtil import com.onresolve.scriptrunner.runner.util.UserMessageUtil
    
-// Successful Action Message+// Successful Action Message (green)
 UserMessageUtil.success("Created two sub-tasks to be approved") UserMessageUtil.success("Created two sub-tasks to be approved")
    
logging.1515766938.txt.gz · Last modified: (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki