Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Phil Dye 147 posts 302 karma points
    Oct 16, 2013 @ 19:39
    Phil Dye
    0

    Exception when using legacy log4net

    For legacy reasons with another component in a site, we need to use two versions of log4net, as documented elsewhere (sorry, don't have the link to hand).

    This causes a YSOD from UrlTracker when it's trying to init log4net;

        Exception message: Sequence contains more than one matching element
       at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
       at InfoCaster.Umbraco.UrlTracker.Helpers.UrlTrackerLoggingHelper.LogToLog4net(String message, Exception exception)
       at InfoCaster.Umbraco.UrlTracker.Helpers.UrlTrackerLoggingHelper.LogInformation(String message)
       at InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.Init(HttpApplication context)
    

    Looks like a simple .First() would suffice in

     if (!UrlTrackerLoggingHelper._log4netAssemblyInitialized)
        UrlTrackerLoggingHelper._log4netAssembly = Enumerable.SingleOrDefault<Assembly>((IEnumerable<Assembly>) AppDomain.CurrentDomain.GetAssemblies(), (Func<Assembly, bool>) (x => x.FullName.StartsWith("log4net")));
    

    in case there's more than 1?

    Phil

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 16, 2013 @ 19:45
    Stefan Kip
    100

    Yes you're right, thanks for reporting this.
    Could you try version 2.2.5?

  • Phil Dye 147 posts 302 karma points
    Oct 16, 2013 @ 20:00
    Phil Dye
    0

    Thanks Stefan, that's fixed it.

    And what an awesome turnaround speed on the fix by the way - H5YR!

    Phil

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 16, 2013 @ 20:16
    Stefan Kip
    0

    Just doing the best I can ;-) Still got a few non-answered topics left, but this was a really easy fix.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies