Clog and .Net 4.0

Apr 20, 2010 at 8:32 PM

Hi,

I get an exception I don´t know how to get past. Maybe it is just a newbie exception. The exception is from a .Net 4.0 Web Site. I´m using log4net and have got the configuration from the examples provided. The exception I get is:

System.TypeInitializationException was unhandled by user code
  Message=The type initializer for 'DanielVaughan.Logging.Log' threw an exception.
  Source=DanielVaughan.Logging
  TypeName=DanielVaughan.Logging.Log
  StackTrace:
       at DanielVaughan.Logging.Log.Info(String message)
       at MediaLibraryLogging.Presentation._Default.Page_Load(Object sender, EventArgs e) in <path-to-website>\Default.aspx.cs:line 17
       at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
       at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: System.ArgumentNullException
       Message=Value cannot be null.
Parameter name: key
       Source=mscorlib
       ParamName=key
       StackTrace:
            at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
            at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
            at DanielVaughan.Logging.Configuration.LogRepository.Load(XmlElement rootElement)
            at DanielVaughan.Logging.Log.InitFromConfig()
            at DanielVaughan.Logging.Log..cctor()
       InnerException:

Does someone know what to do with this?

Regards,

Fredrik

Coordinator
Apr 20, 2010 at 8:38 PM

Hi Fredrik,

Could you post your Clog config section please.

Cheers,

Daniel

Apr 20, 2010 at 9:01 PM

In web.config I have:

  <configSections>
    <section name="Clog" type="DanielVaughan.Logging.Configuration.ClientLoggingConfigurationSectionHandler, DanielVaughan.Logging"/>
  </configSections>

and

    <!-- InternalLogLevel is used to monitor log messages originating from Clog,
    and which are written to the console. Valid values are (from less to most restrictive):
    All, Debug, Info, Warn, Error, Fatal, None. -->
    <Clog InternalLogLevel="All" xmlns="http://danielvaughan.orpius.com/Clog/2/0/">
      <LogStrategy Name="Log4Net" Type="DanielVaughan.Logging.LogStrategies.Log4NetStrategy, DanielVaughan.Logging.Log4NetLogStrategy">
        <Filter Name="IPAddressRange" Type="DanielVaughan.Logging.Filters.IPAddressRangeFilter, DanielVaughan.Logging" Begin="127.0.0.0" End="127.0.0.10"/>
        <!-- Uncomment to prevent access to those users that do now have membership of the specified roles. -->
        <!-- <Filter Name="RoleMembership" type="DanielVaughan.Logging.Filters.RoleMembershipFilter, DanielVaughan.Logging" Roles="Developer, Administrator" /> -->
      </LogStrategy>
  </Clog>

 

Coordinator
Apr 20, 2010 at 9:03 PM

Try commenting out the IPAddressRange filter.

 

Apr 20, 2010 at 9:11 PM

Thanks for the really fast response but I still got the same error message unfortunately.

Coordinator
Apr 20, 2010 at 9:16 PM

Fredrik, are you using the latest version from http://calcium.codeplex.com ?

Apr 20, 2010 at 9:25 PM

I'm using v.1.10 from http://clog.codeplex.com and it works now! :-) It took a few restarts of the website but now it works. I tried enabling IPAddressRange to see if that was the problem (I don´t currently need it) and it was, it stopped working again. Thanks again for all help.

Coordinator
Apr 20, 2010 at 9:32 PM

I think it may be an IPv6 issue. I'll look into it. Glad it's now working for you.

Cheers,

Daniel

 

Apr 21, 2010 at 7:25 AM

Hmm, maybe I was to quick shouting out that it worked. Well, it is working on the server side. But when I try to log on the client side I get a error message in the server side services. It seems like the configuration still isn't loaded correctly.

The type initializer for 'DanielVaughan.Logging.Log' threw an exception.

System.TypeInitializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

System.ArgumentNullException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

DanielVaughan.Logging.Log.GetLogLevel(IClientInfo info)
DanielVaughan.Logging.ClogService.GetConfiguration(IClientInfo clientInfo)
SyncInvokeGetConfiguration(Object , Object[] , Object[] )

Apr 22, 2010 at 7:47 AM

Somehow it doesn't read the configuration when the getConfiguration request come from the client. I get "Clog Error:LogStrategy is missing or of wrong type. Name: System.Configuration.ConfigXmlAttribute" .

Apr 22, 2010 at 2:03 PM

Sorry about these posts, it was a bug in my environment. My project had lost the reference to the DanielVaughan.Logging.Log4NetLogStrategy.dll. I'm don't know why though. But when I added it again it started working on both server and client.

Thanks for a great product,

// Fredrik

Coordinator
Apr 22, 2010 at 2:21 PM

Glad you got it sorted Fredrik. Thanks for letting me know.

Cheers,

Daniel