Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
Is there any way you can make error log entries more helpful? It's almost impossible to figure out the error unless we can reproduce it on a local site when stepping through the code in debug mode. Or are you constrained by the way MVC does it?
|
|
|
|
Rank: Advanced Member
Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System Joined: 10/11/2018(UTC) Posts: 110
Thanks: 19 times Was thanked: 18 time(s) in 18 post(s)
|
Judy, Which version are you using? In 9.0.6 this bug is fixed to show the helpful information from the exception. [AC9-1575] - Error details are not enough to debug in the case of CMS related errors
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
These sites were all on versions older than 9.0.6. I think I'll see if I can integrate the 9.0.6 code into them- they both have the source code, if that is where the change is. Thanks
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
We are still on version 9.0.5, and we're not ready to move to 9.0.6; however, this feature is something that I would love to have today. Is it something that does not involve major surgery, what files need to be copied over for this feature to take effect?
Many thanks
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
To fix this issue in versions older than 9.0.6, you can follow the following steps: 1- Open the file \Website\Global.asax.cs 2- Search for Code:
if (doLogError)
{
string errorInfo = "An error has occured at " + Request.Url.ToString();
Logger.Error(errorInfo, exception);
}
3- Replace with Code:if (doLogError)
{
string errorInfo = "An error has occured at " + Request.Url.ToString();
var root = exception.GetBaseException();
if (root != null)
{
exception = root;
}
Logger.Error(errorInfo, exception);
}
4- Open file CommerceBuilder.Web\Extensions\HtmlExtensions.cs 5- Search for Code:
if (canEditStore)
{
Logger.Error(exception.Message, exception);
var page = html.ViewDataContainer as WebViewPage;
TagBuilder builder = new TagBuilder("div");
builder.MergeAttribute("class", "failed-widget");
if (exception.InnerException != null)
builder.InnerHtml = exception.InnerException.Message;
else
builder.InnerHtml = exception.Message;
page.Write(MvcHtmlString.Create(builder.ToString()));
}
else
{
throw exception;
}
6- Replace with Code:
if (canEditStore)
{
Logger.Error(exception.Message, exception);
var page = html.ViewDataContainer as WebViewPage;
TagBuilder builder = new TagBuilder("div");
builder.MergeAttribute("class", "failed-widget");
if (exception.InnerException != null)
builder.InnerHtml = exception.InnerException.Message;
else
builder.InnerHtml = exception.Message;
page.Write(MvcHtmlString.Create(builder.ToString()));
}
else
{
throw;
}
7- Compile and build the complete project Make sure to test locally before making the changes to the live site. Hope this helps!
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
Thank you so much for providing this information. My development team likes to wait at least 60 to 90 days before applying an upgrade. We just want the dust to settle, but we felt this feature would be of tremendous benefit, and we wanted to implement it as quickly as possible.
I will make the appropriate changes, recompiled everything, and submit to the live site, if we run into any problems, I will simply replace the two DLL's.
Many thanks for this information
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
AC: It would be great if you could add userid and ip address to error logging. (I have just done that in global.asax.cs on a site). It really would help id troubleshooting and error or trying to figure out if it is a bot causing the problem. We used to use Elmah error logging on some sites and the ip was particularly helpful in examining attempted hacks or bots running the sites.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close