public function append(LoggerLoggingEvent $event) {

		for ($attempt = 1; $attempt <= $this->reconnectAttempts + 1; $attempt++) {
			try {
				// Attempt to write to database
				$this->preparedInsert->execute($this->format($event));
				$this->preparedInsert->closeCursor();
				break;
			} catch (PDOException $e) {
				$this->warn("Failed writing to database: ". $e->getMessage());
				
				// Close the appender if it's the last attempt
				if ($attempt > $this->reconnectAttempts) {
					$this->warn("Failed writing to database after {$this->reconnectAttempts} reconnect attempts. Closing appender.");
					$this->close();
				// Otherwise reconnect and try to write again
				} else {
					$this->warn("Attempting a reconnect (attempt $attempt of {$this->reconnectAttempts}).");
					$this->establishConnection();
				}
			}
		}
	}
public function append(LoggerLoggingEvent $event) {

		for ($attempt = 1; $attempt <= $this->reconnectAttempts + 1; $attempt++) {
			try {
				// Attempt to write to database
				$this->preparedInsert->execute($this->format($event));
				$this->preparedInsert->closeCursor();
				break;
			} catch (PDOException $e) {
				$this->warn("Failed writing to database: ". $e->getMessage());
				
				// Close the appender if it's the last attempt
				if ($attempt > $this->reconnectAttempts) {
					$this->warn("Failed writing to database after {$this->reconnectAttempts} reconnect attempts. Closing appender.");
					$this->close();
				// Otherwise reconnect and try to write again
				} else {
					$this->warn("Attempting a reconnect (attempt $attempt of {$this->reconnectAttempts}).");
					$this->establishConnection();
				}
			}
		}
	}
public function append ( LoggerLoggingEvent $ event ) { for ( $ attempt = 1 ; $ attempt <= $ this -> reconnectAttempts + 1 ; $ attempt ++ ) { try { // Attempt to write to database
 $ this -> preparedInsert -> execute ( $ this -> format ( $ event ) ) ; $ this -> preparedInsert -> closeCursor ( ) ; break ; } catch ( PDOException $ e ) { $ this -> warn ( "Failed writing to database: " . $ e -> getMessage ( ) ) ; // Close the appender if it's the last attempt
 if ( $ attempt > $ this -> reconnectAttempts ) { $ this -> warn ( "Failed writing to database after {$this->reconnectAttempts} reconnect attempts. Closing appender." ) ; $ this -> close ( ) ; // Otherwise reconnect and try to write again
 } else { $ this -> warn ( "Attempting a reconnect (attempt $attempt of {$this->reconnectAttempts})." ) ; $ this -> establishConnection ( ) ; } } } }
Appends a new event to the database.

If writing to database fails, it will retry by re-establishing the
connection up to $reconnectAttempts times. If writing still fails,
the appender will close.
Appends a new event to the database .