protected function write($string) {
		// Lazy file open
		if(!isset($this->fp)) {
			if ($this->openFile() === false) {
				return; // Do not write if file open failed.
			}
		}
		
		// Lock the file while writing and possible rolling over
		if(\n2n\io\IoUtils::flock($this->fp, LOCK_EX)) {
			
			// Write to locked file
			if(\n2n\io\IoUtils::fwrite($this->fp, $string) === false) {
				$this->warn("Failed writing to file. Closing appender.");
				$this->closed = true;
			}
			
			// Stats cache must be cleared, otherwise \n2n\io\IoUtils::filesize() returns cached results
			// If supported (PHP 5.3+), clear only the state cache for the target file
			if ($this->clearConditional) {
				clearstatcache(true, $this->file);
			} else {
				clearstatcache();
			}
			
			// Rollover if needed
			if (\n2n\io\IoUtils::filesize($this->file) > $this->maxFileSize) {
				try {
					$this->rollOver();
				} catch (\n2n\log4php\LoggerException $ex) {
					$this->warn("Rollover failed: " . $ex->getMessage() . " Closing appender.");
					$this->closed = true;
				}
			}
			
			\n2n\io\IoUtils::flock($this->fp, LOCK_UN);
		} else {
			$this->warn("Failed locking file for writing. Closing appender.");
			$this->closed = true;
		}
	}