Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Log full exceptions when available to aid in debugging #1948

Merged
merged 1 commit into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/IdentityServer4/Infrastructure/BackChannelLogoutClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


Expand Down Expand Up @@ -64,7 +64,7 @@ private async Task SendLogoutAsync(BackChannelLogoutModel client)
}
catch(Exception ex)
{
_logger.LogError("Exception invoking back channel logout for client id: {0} to URI: {1}, message: {2}", client.ClientId, client.LogoutUri, ex.Message);
_logger.LogError(ex, "Exception invoking back channel logout for client id: {0} to URI: {1}", client.ClientId, client.LogoutUri);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/IdentityServer4/Infrastructure/MessageCookie.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


Expand Down Expand Up @@ -113,7 +113,7 @@ private Message<TModel> ReadByCookieName(string name)
}
catch(Exception ex)
{
_logger.LogError("Error unprotecting message cookie: {exception}", ex.Message);
_logger.LogError(ex, "Error unprotecting message cookie");
ClearByCookieName(name);
}
}
Expand Down Expand Up @@ -157,7 +157,7 @@ private long GetCookieRank(string name)
catch (CryptographicException e)
{
// cookie was protected with a different key/algorithm
_logger.LogDebug("Unable to unprotect cookie {0}: {1}", name, e.Message);
_logger.LogDebug(e, "Unable to unprotect cookie {0}", name);
}

return rank;
Expand Down
4 changes: 2 additions & 2 deletions src/IdentityServer4/Services/DefaultPersistedGrantService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


Expand Down Expand Up @@ -92,7 +92,7 @@ public async Task<IEnumerable<Consent>> GetAllGrantsAsync(string subjectId)
}
catch (Exception ex)
{
_logger.LogError("Failed processing results from grant store. Exception: {0}", ex.Message);
_logger.LogError(ex, "Failed processing results from grant store.");
}

return Enumerable.Empty<Consent>();
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityServer4/Services/DefaultUserSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public virtual async Task<IEnumerable<string>> GetClientListAsync()
}
catch (Exception ex)
{
Logger.LogError("Error decoding client list: {0}", ex.Message);
Logger.LogError(ex, "Error decoding client list");
// clear so we don't keep failing
await SetClientsAsync(null);
}
Expand Down
4 changes: 2 additions & 2 deletions src/IdentityServer4/Stores/Default/DefaultGrantStore.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


Expand Down Expand Up @@ -97,7 +97,7 @@ protected virtual async Task<T> GetItemAsync(string key)
}
catch (Exception ex)
{
Logger.LogError("Failed to deserailize JSON from grant store. Exception: {0}", ex.Message);
Logger.LogError(ex, "Failed to deserialize JSON from grant store.");
}
}
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


Expand Down Expand Up @@ -40,7 +40,7 @@ public Task<Message<TModel>> ReadAsync(string value)
}
catch(Exception ex)
{
_logger.LogError("Exception reading message: {0}", ex.Message);
_logger.LogError(ex, "Exception reading protected message");
}
}

Expand All @@ -60,7 +60,7 @@ public Task<string> WriteAsync(Message<TModel> message)
}
catch(Exception ex)
{
_logger.LogError("Exception writing message: {0}", ex.Message);
_logger.LogError(ex, "Exception writing protected message");
}

return Task.FromResult(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Task<SecretValidationResult> ValidateAsync(IEnumerable<Secret> secrets, P
}
catch (Exception e)
{
_logger.LogError("Could not parse assertion as JWT token: {e}", e);
_logger.LogError(e, "Could not parse assertion as JWT token");
return fail;
}

Expand Down Expand Up @@ -109,7 +109,7 @@ public Task<SecretValidationResult> ValidateAsync(IEnumerable<Secret> secrets, P
}
catch (Exception e)
{
_logger.LogError("JWT token validation error: " + e.Message);
_logger.LogError(e, "JWT token validation error");
return fail;
}
}
Expand Down