Page 1 of 1

Function LogToFile

Posted: Wed Jul 26, 2006 6:11 pm
by Nosferatu
Can some one help with fileacces.cfg
what i must write in it ?
I want to use function LogToFile() at textcmd but file doesnot creating
var err := LogToFile( "::gm_log.txt", "Logsss" );
print(err);
after use that code console says me {"access denied"};
help me pls
thnx

Posted: Thu Jul 27, 2006 12:32 am
by CWO

Code: Select all

FileAccess
{
    Package mypackage
    Extension .log
    AllowWrite 1
    AllowAppend 1
}
You probably want something like that for your script logging. Just change 'mypackage' to the pkg name where your script resides and make sure the extension of the file you're logging to is .log. If you want it different, then change the .log listed as the Extension.

Posted: Thu Jul 27, 2006 12:39 am
by Bytehawk
As far as I understand it, reading from and writing or appending to files works in packages only. So your textcommand has to be in a package (e. g. pol/pkg/tools/mytool/textcmd/gm/logmsg.src). It wont work with a textcommand in pol/scripts/textcmd/

Posted: Thu Jul 27, 2006 1:09 am
by CWO
actually yes it does work in /scripts Bytehawk. Although my shard has this

Code: Select all

FileAccess
{
    Package *
    Extension .log
    AllowWrite 1
    AllowAppend 1
    AllowRead 1
    AllowRemote 1
}
of course this means any script can read/write/append to any .log file but since on my shard, we script everything ourselves so we dont have a problem with that. We can make everything go to the /log path.

Posted: Thu Jul 27, 2006 1:50 am
by Harley
You see, I have this problem too!

http://forums.polserver.com/viewtopic.p ... 5&start=30

Problem is:

Code: Select all

Starting: SpawnNet 
error{ errortext = "Access denied" } 
syslog: [pkg/systems/serverstatus/status.ecl]: error{ errortext = "Access denied 
" } 
Starting: Ore Server.
line of script:

Code: Select all

 x := WriteFile(FILENAME, arr); 

  if( x == error) 
    print(x); 
    syslog(x); 
  endif
At fileaccess is:

Code: Select all

FileAccess
{
  Package	serverstatus
  Extension     *
  AllowRead	1
  AllowWrite	1
  AllowAppend	1
  AllowRemote	0
}
Why I have thoose error, I don't know :( If some one know what to do, please help me! Help us!

Thanks!

p.s. like some info about core. This error I have received at change core version to 097. At version 096 it's all right!

Posted: Fri Jul 28, 2006 7:40 pm
by Nosferatu
Thnx for all
Log's are working :-)
but i have new problem!
How i can add to log File timeStamp?

Posted: Fri Jul 28, 2006 8:43 pm
by CWO
in POL095 you need to calculate the time from polcore().systime. Theres a script floating somewhere around here on that.

Posted: Sat Jul 29, 2006 8:48 pm
by Nosferatu
Okey thnx all for help
I find needed include files .
The convert polcore().systime to real time )