Skip to content

Commit

Permalink
OnPersistRejected now logs an error with the complete stacktrace (#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelhamed authored and Aaronontheweb committed Apr 25, 2019
1 parent 9cfa5a2 commit 5ca783f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/core/Akka.Persistence/Eventsourced.cs
Expand Up @@ -469,7 +469,7 @@ protected virtual void OnRecoveryFailure(Exception reason, object message = null
{
if (message != null)
{
Log.Error(reason, "Exception in ReceiveRecover when replaying event type [{0}] with sequence number [{1}] for persistenceId [{2}]",
Log.Error(reason, "Exception in ReceiveRecover when replaying event type [{0}] with sequence number [{1}] for persistenceId [{2}]",
message.GetType(), LastSequenceNr, PersistenceId);
}
else
Expand Down Expand Up @@ -499,7 +499,7 @@ protected virtual void OnPersistFailure(Exception cause, object @event, long seq

/// <summary>
/// Called when the journal rejected <see cref="Eventsourced.Persist{TEvent}(TEvent,Action{TEvent})"/> of an event.
/// The event was not stored. By default this method logs the problem as a warning, and the actor continues.
/// The event was not stored. By default this method logs the problem as an error, and the actor continues.
/// The callback handler that was passed to the <see cref="Eventsourced.Persist{TEvent}(TEvent,Action{TEvent})"/>
/// method will not be invoked.
/// </summary>
Expand All @@ -508,9 +508,8 @@ protected virtual void OnPersistFailure(Exception cause, object @event, long seq
/// <param name="sequenceNr">TBD</param>
protected virtual void OnPersistRejected(Exception cause, object @event, long sequenceNr)
{
if (Log.IsWarningEnabled)
Log.Warning("Rejected to persist event type [{0}] with sequence number [{1}] for persistenceId [{2}] due to [{3}].",
@event.GetType(), sequenceNr, PersistenceId, cause.Message);
Log.Error(cause, "Rejected to persist event type [{0}] with sequence number [{1}] for persistenceId [{2}] due to [{3}].",
@event.GetType(), sequenceNr, PersistenceId, cause.Message);
}

/// <summary>
Expand Down

0 comments on commit 5ca783f

Please sign in to comment.