logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
judy at Web2Market  
#1 Posted : Friday, April 15, 2022 5:06:27 AM(UTC)
judy at Web2Market

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?

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

nadeem  
#2 Posted : Tuesday, April 19, 2022 6:14:34 AM(UTC)
nadeem

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
judy at Web2Market  
#3 Posted : Wednesday, April 20, 2022 5:24:10 AM(UTC)
judy at Web2Market

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
ray22901031  
#4 Posted : Wednesday, April 20, 2022 7:26:08 AM(UTC)
ray22901031

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
shaharyar  
#5 Posted : Friday, April 22, 2022 3:48:18 AM(UTC)
shaharyar

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!
ray22901031  
#6 Posted : Friday, April 22, 2022 2:25:44 PM(UTC)
ray22901031

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
judy at Web2Market  
#7 Posted : Tuesday, April 26, 2022 6:21:56 AM(UTC)
judy at Web2Market

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.
Users browsing this topic
Guest (3)
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.