protected override void SendBuffer()

in src/log4net/Appender/AdoNetAppender.cs [454:502]


		protected override void SendBuffer(LoggingEvent[] events)
		{
			if (ReconnectOnError && (Connection == null || Connection.State != ConnectionState.Open))
			{
				LogLog.Debug(declaringType, "Attempting to reconnect to database. Current Connection State: " + ((Connection == null) ? SystemInfo.NullText : Connection.State.ToString()));

				InitializeDatabaseConnection();
			}

			// Check that the connection exists and is open
			if (Connection != null && Connection.State == ConnectionState.Open)
			{
				if (UseTransactions)
				{
					// Create transaction
					// NJC - Do this on 2 lines because it can confuse the debugger
					using (IDbTransaction dbTran = Connection.BeginTransaction())
					{
						try
						{
							SendBuffer(dbTran, events);

							// commit transaction
							dbTran.Commit();
						}
						catch (Exception ex)
						{
							// rollback the transaction
							try
							{
								dbTran.Rollback();
							}
							catch (Exception)
							{
								// Ignore exception
							}

							// Can't insert into the database. That's a bad thing
							ErrorHandler.Error("Exception while writing to database", ex);
						}
					}
				}
				else
				{
					// Send without transaction
					SendBuffer(null, events);
				}
			}
		}