Handling error messages in nopCommerce 4

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
How can I display detailed error messages in nopCommerce 4?  I have added `.UseSetting("detailedErrors", "true")` to the Main() method and this works, but it requires that I recompile the app without that setting when I'm ready for production.  Is there a way to turn this on and off with a setting in a config file, for example?

Thanks!

Jeremy
5 years ago
Did you try setting stdoutLogEnabled="true" in web.config. It'll produce detailed error messages within log directory.
5 years ago
I made that change.  To test, I'm just changing the password in my DB connection string to something that is incorrect.  The error is not showing up in any log file under logs\stdout folder.

Is there something else I need to set?
5 years ago
I'm not particularly sure what you are trying to achieve, but you can try developer exception method.
Put this in your Configure method in Startup.cs

application.UseDeveloperExceptionPage();


Regards
Anshul
5 years ago
Basically, when I deployed our nopCommerce 4 project from my localhost to a dev server yesterday, I was greeted with "Application failed to start".  When I added `.UseSetting("detailedErrors", "true")` and recompiled and sent my new DLL up, I was able to see the error details and fix the problem (a bad database configuration on dev).

What I'm trying to do is turn detailed error messages on or off in different environments possibly with a config setting and also log these errors somewhere besides the nopCommerce log in the admin site.  There are some errors that require more information than one can get from the admin log -- such as when the database is misconfigured and the application fails to start at all.
5 years ago
Okay!  I think I learned something.  On my localhost where the environment is development, I get the detailed error messages but no log.  I published the changes I made for this out to my dev server again and now I see the safe "Application failed to start" message, but I also see the detailed error log in my logs folder.  Cool.

So, now my question is: what if I want to specify that my dev server is actually a development environment?  Once this site is in production, I don't want to display detailed error messages; however, on my localhost and on dev, I want to see those detailed errors.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.