Saving sucess logs and variables content for scripts testing

Good day, I’ve been recently toying around with some custom scripts that don’t necessarily update any fields or status in our RT tickets, so I need your help in finding the best way to test they are running properly.

The two things are would like to do are:

  • Saving a success log once a function or a subroutine has had success. For that I need to know what’s the Perl syntax for doing that, and where does RT save logs by default. In the example I thought (shown in the next image) I would like to save a success log right after the LWP::Agent has managed to communicate successfully with the external API, so I figured the log-saving-statement should go in the line I marked.
    image

  • Another thing that I would like to know is if it’s possible to check the content of a data structure or variable somehow, maybe by printing it somewhere in the RT log as well. I have this populated structure I’m passing on to an API but I want to make sure I’m saving it’s right content first.

By default RT logs to the web server logs I believe for example /var/log/apache/error.log.

You can use RT::Logger->error( "some message" ); to log messages in RT.

https://docs.bestpractical.com/rt/4.4.4/RT_Config.html#Logging