Setting log source for an entire script

Li9
Tera Contributor

Hello,

 

I'm running scheduled script and use ‘gs.log’ to send script log messages to the system logs. To make it easier to identify these messages I'm passing the log source parameter as well, however, if there errors which were not caught by my script logic, these messages will not have the log source I'm using. 

 

My question is, is there a way to set log source for an entire script so that every log entery related to that specific script will show with this source rather than passing the source only in specific messages?

 

I tried to write the script in a way that will catch all failures but still encountered some cases were errors were missed. In such cases, the messages in the logs won’t have my specific log source and since these logs can have a lot of other information, it makes it difficult to identify the issues related to a specific script execution.

 

Thank You,

1 REPLY 1

JosephW1
Tera Guru

I remember this wasn't readily globally available throughout the system when I last looked a few years ago.

So, last time I made my own logger to create this functionality. (Plus a lot of other cool functionalities.)
Today I decided to again look to see if there's now an OOTB way to do so, and found this more recent article with 0 answers.
So, I guess they still have not created this simple yet useful feature?

You can get this feature out of my share project "JRW: An Enhanced Logging Utility".
Here's a preview of what it can do. Please reply if there's now an OOTB method to use instead, thanks.

 

JosephW1_1-1745084610460.png