/**
  * Record to this file.
  * Does not open the logger if not already open. Directory must exist.
  * @param string $name
  */
 public function set_file_name($fn)
 {
     if ($this->_file_name != $fn) {
         if ($this->is_open()) {
             $this->close();
         }
         $url = new FILE_URL($fn);
         $url->ensure_file_exists();
         $this->_file_handle = @fopen($fn, 'a');
         if ($this->is_open()) {
             $this->_file_name = $fn;
             $this->_has_messages = false;
         }
     }
 }