RT boilerplate error: Log file '/local/rt3/var/log/rt.log' couldn't be written or created

I am trying to run some RT queries using the RT boilerplate
from the O’ Reilly All About RT presentation page 188 by Jesse Vincent
as a normal user on a existing RT installation.

#!/usr/bin/perl -w
use strict;
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;

Load the config file

RT::LoadConfig();

Connect to the database and get RT::SystemUser

loaded

RT::Init();

This produces the error.

Log file ‘/local/rt3/var/log/rt.log’ couldn’t be written or created.
RT can’t run. at /local/rt3/lib/RT.pm line 318.

Is there a way to change the location of the of rt.log from within a perl
script. I do not have root priveledges and only want read access for
queries using the API.

Thanks Richard

Dr. Richard G. McMahon | Phone (office) 44-(0)-1223-337519
University of Cambridge | (switchboard) 1223-337548
Institute of Astronomy | (secretary) 1223-337516
Madingley Rd | FAX 1223-337523
Cambridge, CB3 OHA, UK. | mobile 7885-409019
Office: Hoyle 18 | home 1223-359770
email: rgm@ast.cam.ac.uk | WWW: http://www.ast.cam.ac.uk/~rgm
richardgmcmahon@gmail.com | skype: richardgmcmahon

I am trying to run some RT queries using the RT boilerplate
from the O’ Reilly All About RT presentation page 188 by Jesse Vincent
as a normal user on a existing RT installation.

#!/usr/bin/perl -w
use strict;
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;

Load the config file

RT::LoadConfig();

Connect to the database and get RT::SystemUser

loaded

RT::Init();

This produces the error.

Log file ‘/local/rt3/var/log/rt.log’ couldn’t be written or created.
RT can’t run. at /local/rt3/lib/RT.pm line 318.

Is there a way to change the location of the of rt.log from within a perl
script. I do not have root priveledges and only want read access for
queries using the API.

  I do not know if this helps, but in RT_SiteConfig.pm you could

set, for instance,

Set($LogDir,’/tmp/’);
Set($LogToFileNamed, ‘rt.log’);

or wherever it needs to go. About /local/rt3/var/log/rt.log, I wonder
who owns /local/rt3/var/log.

This produces the error.

Log file ‘/local/rt3/var/log/rt.log’ couldn’t be written or created.
RT can’t run. at /local/rt3/lib/RT.pm line 318.

Is there a way to change the location of the of rt.log from within a perl
script. I do not have root priveledges and only want read access for
queries using the API.

 I do not know if this helps, but in RT_SiteConfig.pm you could

set, for instance,

Set($LogDir,’/tmp/’);
Set($LogToFileNamed, ‘rt.log’);

or wherever it needs to go. About /local/rt3/var/log/rt.log, I wonder
who owns /local/rt3/var/log.

thanks

on our system:

/local/rt3/var/log/rt.log is owned by apache

/local/rt3/etc/RT_Config.pm and
/local/rt3/etc/RT_SiteConfig.pm are owned by root

r.

#!/usr/bin/perl -w
use strict;
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;

Load the config file

RT::LoadConfig();

Between RT::LoadConfig() and RT::Init(), you should be able to insert
lines like so to change the variables you need:

RT->Config->Set( LogDir => '...' );

or to disable logging to the file and only log elsewhere (syslog,
screen) as configured:

RT->Config->Set( LogToFile => undef );

Connect to the database and get RT::SystemUser

loaded

RT::Init();

Thomas

This produces the error.

Log file ‘/local/rt3/var/log/rt.log’ couldn’t be written or created.
RT can’t run. at /local/rt3/lib/RT.pm line 318.

Is there a way to change the location of the of rt.log from within a perl
script. I do not have root priveledges and only want read access for
queries using the API.

I do not know if this helps, but in RT_SiteConfig.pm you could

set, for instance,

Set($LogDir,’/tmp/’);
Set($LogToFileNamed, ‘rt.log’);

or wherever it needs to go. About /local/rt3/var/log/rt.log, I wonder
who owns /local/rt3/var/log.

thanks

on our system:

/local/rt3/var/log/rt.log is owned by apache

/local/rt3/etc/RT_Config.pm and
/local/rt3/etc/RT_SiteConfig.pm are owned by root

r.
Sounds like my setup. If this was an ubuntu install, I would see
(or ask someone to do the deed) if apparmor is not allowing the apache
user to create /local/rt3/var/log/rt.log.