Skip to content

Commit

Permalink
Merge pull request apache#71 from Flexberry/fix-npgsql-appender
Browse files Browse the repository at this point in the history
Fix AdoNetAppender using npgsql
  • Loading branch information
fluffynuts authored Dec 8, 2020
2 parents dbad144 + 634ffca commit 2b8b170
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/log4net/Appender/AdoNetAppender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,17 @@ protected virtual void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events)
{
dbCmd.Transaction = dbTran;
}
// prepare the command, which is significantly faster
dbCmd.Prepare();

try
{
// prepare the command, which is significantly faster
dbCmd.Prepare();
}
catch (Exception)
{
// ignore prepare exceptions as they can happen without affecting actual logging, eg on npgsql
}

// run for all events
foreach (LoggingEvent e in events)
{
Expand Down

0 comments on commit 2b8b170

Please sign in to comment.