GithubHelp home page GithubHelp logo

Comments (4)

huorswords avatar huorswords commented on July 2, 2024

Hi @georgechr ,

Thank you very much for your feedback.

Can you provide some additional information in order to reproduce the error on my side?

Thank you. Regards,

Angel

from microsoft.extensions.logging.log4net.aspnetcore.

huorswords avatar huorswords commented on July 2, 2024

I've tried to reproduce the problem but I think that I didn't reproduced it correctly.

Steps

  1. Create a Web API .NET Core project by default.
  2. Configure the extensions on Startup.cs file properly.
  3. Throw an exception from the API/Values default controller action.

The result was that the exception (and the stack trace) was printed on the debug window.

Lab> fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
Lab>       An unhandled exception has occurred while executing the request
Lab> System.Exception: Doh!
Lab>    at Lab.Controllers.ValuesController.Get() in C:\angel\code\github\huorswords\Microsoft.Extensions.Logging.Log4Net.AspNetCore\src\Lab\Controllers\ValuesController.cs:line 16
Lab>    at lambda_method(Closure , Object , Object[] )
Lab>    at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__17.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Lab>    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__15.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Lab>    at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
Lab> --- End of stack trace from previous location where exception was thrown ---
Lab>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Lab>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Lab>    at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

I can't see what you where or what the problem is, so @georgechr please, provide me some information (or an example project) with your expected result and steps to reproduce it.

Thanks.

Angel

from microsoft.extensions.logging.log4net.aspnetcore.

georgechr avatar georgechr commented on July 2, 2024

from microsoft.extensions.logging.log4net.aspnetcore.

huorswords avatar huorswords commented on July 2, 2024

Hello @georgechr,

Thank you very much by your report.

I just added a change on the develop branch in order to use the content of the exception as part of the final message that will be logged.

And, for extensibility questions, I've added also the possibility of configure your own formatter when an exception is included as part of the logged state.

Let me know if these changes will fix your issue.

Thanks

from microsoft.extensions.logging.log4net.aspnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.