Function LogToFile

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
Nosferatu
Journeyman Poster
Posts: 63
Joined: Fri Jul 21, 2006 9:58 pm

Function LogToFile

Post 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
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
Bytehawk
Apprentice Poster
Posts: 56
Joined: Fri Feb 03, 2006 2:25 am

Post 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/
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am

Post 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!
Nosferatu
Journeyman Poster
Posts: 63
Joined: Fri Jul 21, 2006 9:58 pm

Post by Nosferatu »

Thnx for all
Log's are working :-)
but i have new problem!
How i can add to log File timeStamp?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

in POL095 you need to calculate the time from polcore().systime. Theres a script floating somewhere around here on that.
Nosferatu
Journeyman Poster
Posts: 63
Joined: Fri Jul 21, 2006 9:58 pm

Post by Nosferatu »

Okey thnx all for help
I find needed include files .
The convert polcore().systime to real time )
Post Reply