hmm, your code was no problem, but in my case i include the class file with require
so just to explain my scipt looks like this
require(config_file) // this is where the var $LOGFILE is set
require(my_class) // this is where i would need the $LOGFILE
..
do anything
i dont know why, but than it doesnt work, even if your script did it...