Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabled Directive.Resume to log the full Exception #6070

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/core/Akka/Actor/SupervisorStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,16 @@ protected virtual void LogFailure(IActorContext context, IActorRef child, Except
{
if (LoggingEnabled)
{
var actorInitializationException = cause as ActorInitializationException;
string message;
if (actorInitializationException != null && actorInitializationException.InnerException != null)
if (cause is ActorInitializationException actorInitializationException && actorInitializationException.InnerException != null)
message = actorInitializationException.InnerException.Message;
else
message = cause.Message;

switch (directive)
{
case Directive.Resume:
Publish(context, new Warning(child.Path.ToString(), GetType(), message));
Publish(context, new Warning(cause, child.Path.ToString(), GetType(), message));
break;
case Directive.Escalate:
//Don't log here
Expand All @@ -171,7 +170,7 @@ protected virtual void LogFailure(IActorContext context, IActorRef child, Except
/// </summary>
protected bool LoggingEnabled { get; set; }

private void Publish(IActorContext context, LogEvent logEvent)
private static void Publish(IActorContext context, LogEvent logEvent)
{
try
{
Expand Down