Logging from scrips

Hi everyone,
the issue from subject was discussed several times, but sadly I have not
been able to find a solution that is working for me.

I have a scrip that should launch after new ticket is created.

Condition: On Create
Action: User defined
Template: My own defined template
Stage: Transaction create

Inside the user condition I have this piece of code:

$RT::Logger->info(“Entering the scrip I have written”);
$RT::Logger->info($self->TicketObj->Status);
$RT::Logger->info(“Leaving the script I have written”);
return 1;

I would expect this code to write three messages into log and send the
message using given template (the template has everything hardcoded, so
it should be ok). However no mail gets sent and nothing is in log.

This scrip should be running because in rt.log I can see:

[debug]: Found 1 scrips
(/usr/share/request-tracker3.6/lib/RT/Scrips_Overlay.pm:365)

which is changed to 0 when I disable the scrip.

I have enabled the $DevelMode, and set $LogToFile to ‘debug’ (I have
even tried to set $LogToSyslog to ‘debug’), restarted the server, but
nothing happened. There is nothing in rt.log, syslog, apache error.log,
nowhere.

Could you please help me finding where the problem can be?

Best regards
Martin

Dne 9.3.2010 0:29, Martin Drasar napsal(a):

Hi everyone,
the issue from subject was discussed several times, but sadly I have not
been able to find a solution that is working for me.

I have a scrip that should launch after new ticket is created.

Condition: On Create
Action: User defined
Template: My own defined template
Stage: Transaction create

Inside the user condition I have this piece of code:

$RT::Logger->info(“Entering the scrip I have written”);
$RT::Logger->info($self->TicketObj->Status);
$RT::Logger->info(“Leaving the script I have written”);
return 1;

I would expect this code to write three messages into log and send the
message using given template (the template has everything hardcoded, so
it should be ok). However no mail gets sent and nothing is in log.

This scrip should be running because in rt.log I can see:

[debug]: Found 1 scrips
(/usr/share/request-tracker3.6/lib/RT/Scrips_Overlay.pm:365)

which is changed to 0 when I disable the scrip.

I have enabled the $DevelMode, and set $LogToFile to ‘debug’ (I have
even tried to set $LogToSyslog to ‘debug’), restarted the server, but
nothing happened. There is nothing in rt.log, syslog, apache error.log,
nowhere.

Could you please help me finding where the problem can be?

Well it seems that the condition was to blame. Being set to ‘On Create’
my user condition have not been evaluated.

I have changed it to ‘User defined’ and everything works as it should,
including the logging.

Hi everyone,
the issue from subject was discussed several times, but sadly I have not
been able to find a solution that is working for me.

I have a scrip that should launch after new ticket is created.

Condition: On Create
Action: User defined
Template: My own defined template
Stage: Transaction create

Inside the user condition I have this piece of code:

$RT::Logger->info(“Entering the scrip I have written”);
$RT::Logger->info($self->TicketObj->Status);
$RT::Logger->info(“Leaving the script I have written”);
return 1;

I think your problem is that you specified a built-in condition (On
Create) but put your custom code into the Custom condition text box.
You should either change the Condition to “User Defined” or put your
code into one of the action text boxes since you have the Action set to
“User Defined”

I would expect this code to write three messages into log and send the
message using given template (the template has everything hardcoded, so
it should be ok). However no mail gets sent and nothing is in log.

This scrip should be running because in rt.log I can see:

[debug]: Found 1 scrips
(/usr/share/request-tracker3.6/lib/RT/Scrips_Overlay.pm:365)

which is changed to 0 when I disable the scrip.

I have enabled the $DevelMode, and set $LogToFile to ‘debug’ (I have
even tried to set $LogToSyslog to ‘debug’), restarted the server, but
nothing happened. There is nothing in rt.log, syslog, apache error.log,
nowhere.

Could you please help me finding where the problem can be?

Best regards
Martin


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)