Browse Source

Improved logging

master
Savorboard 6 years ago
parent
commit
5a2403052e
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      src/DotNetCore.CAP/Abstractions/CapPublisherBase.cs

+ 5
- 4
src/DotNetCore.CAP/Abstractions/CapPublisherBase.cs View File

@@ -182,7 +182,7 @@ namespace DotNetCore.CAP.Abstractions
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError("An exception was occurred when publish message. exception message:" + e.Message, e);
_logger.LogError(e, "An exception was occurred when publish message async. exception message:" + name);
s_diagnosticListener.WritePublishMessageStoreError(operationId, message, e); s_diagnosticListener.WritePublishMessageStoreError(operationId, message, e);
Console.WriteLine(e); Console.WriteLine(e);
throw; throw;
@@ -204,10 +204,11 @@ namespace DotNetCore.CAP.Abstractions


try try
{ {
operationId = s_diagnosticListener.WritePublishMessageStoreBefore(message);
Console.WriteLine("================22222222222222=====================");
operationId = s_diagnosticListener.WritePublishMessageStoreBefore(message);


var id = Execute(DbConnection, DbTransaction, message); var id = Execute(DbConnection, DbTransaction, message);
Console.WriteLine("================777777777777777777777=====================");
ClosedCap(); ClosedCap();


if (id > 0) if (id > 0)
@@ -220,7 +221,7 @@ namespace DotNetCore.CAP.Abstractions
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError("An exception was occurred when publish message. exception message:" + e.Message, e);
_logger.LogError(e, "An exception was occurred when publish message. message:" + name);
s_diagnosticListener.WritePublishMessageStoreError(operationId, message, e); s_diagnosticListener.WritePublishMessageStoreError(operationId, message, e);
Console.WriteLine(e); Console.WriteLine(e);
throw; throw;


Loading…
Cancel
Save