My project log file is getting flooded with entries like this:
2016-12-15 15:37:29,400 [P884120/D110/T1878] WARN Merchello.Web.Caching.VirtualContentCache`2[[Merchello.Web.Models.VirtualContent.IProductContent, Merchello.Web, Version=2.3.6127.15557, Culture=neutral, PublicKeyToken=null],[Merchello.Core.Models.IProduct, Merchello.Core, Version=2.3.6127.15554, Culture=neutral, PublicKeyToken=null]] - Could not map all items to virtual content
I have serached and Googled and can't find any clues about what to do about it - does anyone have any suggestions? Obviously I can change the logging level, but the underlying problem must be having a performance impact, so I'd like to fix it!
As far as I can see all the products have the same document type assigned. There are 40 products in total, but the error appears in the log in groups of 16. I do have 16 collections that I have created, in addition to the Featured Products and T-shirts collections which were part of the FastTrack template.
The numbers do line up - which I agree seems suspicious. Do you know which which page is generating the log messages? Are you seeing errors in your site - or just the warning logs.
Just wondering if we have a situation where we're erroneously logging something ...
I've just run a quick test to see more exactly when this happens.
On the top level store page it logs the 16 warnings twice (i.e. if there is something iterating through a collection causing the warnings, it runs through it twice). On the catalog page, listing the collections, it logs the warnings once (one set of 16). On a collection page it logs the warnings once. On a specific product page it logs the warnings once.
That's certainly the thing that seems to be swamping the log at the moment. There might be something else in the noise, but I haven't noticed anything.
If it helps I think I have identified this macro which goes through the collections and seems to raise a warning for each one - at least the warnings disappear when I comment the macro out:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Merchello.Web.Models.Ui.Rendering
@using ContentModels = Umbraco.Web.PublishedContentModels;
@using Merchello.Core
@using Merchello.Web.Models.Ui
@using Umbraco.Core.Models
@using Umbraco.Web
@using Merchello.Web
@using Merchello.Core.Services
@{
var ecs = MerchelloContext.Current.Services.EntityCollectionService;
var collections = ecs.GetRootLevelEntityCollections(EntityType.Product).OrderBy(p => p.Name);
}
<ul>
@foreach (Merchello.Core.Models.Interfaces.IEntityCollection col in collections)
{
var page = Merchello.FastTrack.Ui.ExampleUiHelper.Content.GetCategoryPageForCollection(col.Key);
if (page != null)
{
<li><a href="@page.Url">@col.Name</a></li>
}
}
</ul>
Does that help to nail it down? The code 'works' in that it puts out the menu as expected, but it raises the warning message for each collection.
this error is add to log file
when i use MerchelloHelper.TypedProductContentFromCollection(guid) in cshtml file
e.g.:
Merchello.Web.Caching.VirtualContentCache`2[[Merchello.Web.Models.VirtualContent.IProductContent, Merchello.Web, Version=2.5.6275.24394, Culture=neutral, PublicKeyToken=null],[Merchello.Core.Models.IProduct, Merchello.Core, Version=2.5.6275.24390, Culture=neutral, PublicKeyToken=null]] - Could not map all items to virtual content
This will result in an ItemsPerPage equal to long.MaxValue.
Also a corner case that would cause this logging statement to be printed would be at the last page (where items.Count() would be less than Page.ItemsPerPage).
@rustyswayne let us know if this line is really supposed to be comparing items.Count() to ItemsPerPage
I've been trying to remember how I got around this problem, so I just revisited the log files, and the answer is I never found the solution. The log file is still getting swamped with 'Could not map all items to virtual content' errors. The site seems to be performing OK, although it's not particularly high traffic, so the lack of efficiency isn't causing a problem.
Could not map all items to virtual content
Hi,
My project log file is getting flooded with entries like this:
I have serached and Googled and can't find any clues about what to do about it - does anyone have any suggestions? Obviously I can change the logging level, but the underlying problem must be having a performance impact, so I'd like to fix it!
Cheers,
Crac
Do you have any products in the result set that do not have a document type assigned?
Hi Rusty,
As far as I can see all the products have the same document type assigned. There are 40 products in total, but the error appears in the log in groups of 16. I do have 16 collections that I have created, in addition to the Featured Products and T-shirts collections which were part of the FastTrack template.
Is that likely to be relevant?
Cheers,
Crac
Hi Crac
The numbers do line up - which I agree seems suspicious. Do you know which which page is generating the log messages? Are you seeing errors in your site - or just the warning logs.
Just wondering if we have a situation where we're erroneously logging something ...
Hi,
I've just run a quick test to see more exactly when this happens.
On the top level store page it logs the 16 warnings twice (i.e. if there is something iterating through a collection causing the warnings, it runs through it twice). On the catalog page, listing the collections, it logs the warnings once (one set of 16). On a collection page it logs the warnings once. On a specific product page it logs the warnings once.
Does that help?
Cheers,
Crac
That does give me somewhere to look and try to replicate. It would be good to log this issue in the issue tracker.
Can you also confirm that, other than the warnings, there does not seem to be anything else going on?
That's certainly the thing that seems to be swamping the log at the moment. There might be something else in the noise, but I haven't noticed anything.
Cheers,
Crac
Hi,
If it helps I think I have identified this macro which goes through the collections and seems to raise a warning for each one - at least the warnings disappear when I comment the macro out:
Does that help to nail it down? The code 'works' in that it puts out the menu as expected, but it raises the warning message for each collection.
I'm sure it's something obvious.
Cheers,
Crac
Did you get a solution for the Caractacus?
this error is add to log file when i use MerchelloHelper.TypedProductContentFromCollection(guid) in cshtml file
e.g.: Merchello.Web.Caching.VirtualContentCache`2[[Merchello.Web.Models.VirtualContent.IProductContent, Merchello.Web, Version=2.5.6275.24394, Culture=neutral, PublicKeyToken=null],[Merchello.Core.Models.IProduct, Merchello.Core, Version=2.5.6275.24390, Culture=neutral, PublicKeyToken=null]] - Could not map all items to virtual content
I've got this warning as well using 2.3.0 and 2.5.0.
Tried multiple things so far:
Since all of this always yielded the same warning I went and read the source code.
It seems like this warning is being printed here.
Reading the condition that guards that logging statement it seems like it is expecting the retrieved Items to be equal to ItemsPerPage.
Since in our case we are invoking the function:
This will result in an ItemsPerPage equal to long.MaxValue. Also a corner case that would cause this logging statement to be printed would be at the last page (where items.Count() would be less than Page.ItemsPerPage).
@rustyswayne let us know if this line is really supposed to be comparing items.Count() to ItemsPerPage
We've also started to hit this issue, any help would be massively appreciated. Thanks
I've been trying to remember how I got around this problem, so I just revisited the log files, and the answer is I never found the solution. The log file is still getting swamped with 'Could not map all items to virtual content' errors. The site seems to be performing OK, although it's not particularly high traffic, so the lack of efficiency isn't causing a problem.
I'd like to find an answer too!
Cheers,
Crac
as Bliss Applications wrote this problem is in that line: if (items.Count() != page.ItemsPerPage)
Lee fixed it (https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Caching/VirtualContentCache%7BT%7D.cs#L151),
I've downloaded source, build and upgrade bin files and it works!!
is working on a reply...