Page 1 of 1

Logtofile

Posted: Wed Mar 26, 2008 2:18 am
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)

Posted: Wed Mar 26, 2008 3:49 am
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.

Posted: Wed Mar 26, 2008 8:16 am
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"

Posted: Wed Mar 26, 2008 9:15 am
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" );

Posted: Wed Mar 26, 2008 11:20 am
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...

Posted: Wed Mar 26, 2008 1:12 pm
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.