Logtofile

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am

Logtofile

Post by coltain »

simple txt command:

Code: Select all

use file;

program txtlog(kto)
LogToFile("e:/FTP/gm/LOGI/gracze/aaa.log", "aaaa",LOG_DATETIME);
endprogram
works just fine

but when i use LogToFile("e:/FTP/gm/LOGI/gracze/aaa.log", "aaaa",LOG_DATETIME); in any package error comes out: "Unable to open file: aaa.log"
How to allow a package to log data anywhere I want (i can log data in some package)
User avatar
AsYlum
Grandmaster Poster
Posts: 115
Joined: Sun Feb 05, 2006 5:24 am

Post by AsYlum »

I think you need to add proper entry to fileaccess.cfg file.

http://docs.polserver.com/pol097/configfiles.php

For example. I have logging package 'logger' All functions needed for logging stuff goes through this pkg. In fileaccess.cfg i've to add something like this:

Code: Select all

FileAccess logs
{
    Package     *
    Extension   .log
    AllowRemote 1
    AllowWrite  1
    AllowAppend 1
}
That means all packages have file access to *.log files.
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am

Post by coltain »

Yes, I have this.

FileAccess
{
Package *
Directory *
Extension .log
AllowRead 1
AllowWrite 1
AllowAppend 1
AllowRemote 1
}

As I wrote I can log anything, but it has to be in any package.

"Unable to open file: commandlog/logs/e:/FTP/gm/LOGI/aaa.log"
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Post by Pierce »

You need to set a pol package conform file structure, something like the following example:

Code: Select all

var filename := "::pkg/opt/LogSystem/test.log";
LogToFile( filename, "blahblah" );
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am

Post by coltain »

Well..

So if I use .logtext then I can log it anywhere I want???? (eg. e:/Logs/)
But if I use pkg and log something in it so I must log it in a pkg???

I wander what if I use start_script to start working cmd_txt script...
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Post by Pierce »

Imho you can't give a LogToFile command with a directory outside the pol packages, e.g. a named directory like "harddisk:\dir". If you are a linux user, write a crontab to move these logs into your wanted directory. I personally found no other way yet.
Post Reply