Log Entries from client not being logged - no errors

Jun 1, 2010 at 8:45 AM

Hi Daniel,

My environment - VS-2008-SP1, Silverlight3.0, log4net

I am new to CLOG and Silverlight. I am in the process of writing a silverlight app and have made reasonable progress and I have come to a point that I need to have logging in place. I was looking for client side logging options and CLOG seemed to be very promising. I just downloaded the 1.10 binaries.

I have tried to follow all the configuration and initialization steps that you have mentioned in the CodeProject website. But when I try to log from client nothing is written to the logs. I don't see any errors.

NOTE: log4net is able to log fine from the server side. 


    <!-- log4net: http://logging.apache.org/log4net -->
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
    <!-- Clog: http://clog.codeplex.com/
         Clog - uses log4net -->

    <section name="Clog"

  <!-- log4net: http://logging.apache.org/log4net -->
      <level value="DEBUG" />
      <appender-ref ref="LogFileAppender" />
    <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
      <param name="File" value="C:\Temp\log.txt" />
      <param name="AppendToFile" value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%-5p%d{yyyy-MM-dd hh:mm:ss} – %m%n" />
  <!-- Clog: http://clog.codeplex.com/
         Clog - uses log4net -->

  <!-- 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.
    Xmlns is specified in order to gain intellisense within the Visual Studio config editor.
    Place the Clog schema located in the project\Schemas directory
    into C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas directory.
    SkipFrameCount is used to specify the number of frames to skip when resolving
    the calling method of a write log call. Defaults to 4 if absent. -->

  <Clog xmlns="http://danielvaughan.orpius.com/Clog/2/0/"
        InternalLogLevel="All" SkipFrameCount="4">
    <LogStrategy Name="Log4Net"
      <Filter Name="IPAddressRange"
          Begin="" End=""/>
      <!-- Uncomment to prevent access to those users that
                 do now have membership of the specified roles. -->

            <Filter Name="RoleMembership"
                Roles="Developer, Administrator" />


 Server Side - Configured


 Code in MainPage.cs

         static readonly ILog log = LogManager.GetLog(typeof(MainPage));

                        log.Info("Log Client Info");
                        log.Error("Log Client Error");
                        log.Debug("Log Client Debug");

The above three statements don't produce any entry in the log. There are no errors.

Since I have not seen any errors + I have not seen anything in the VS Output window too related to CLOG gives me a feeling that I am missing something. Code Project site does not ask to create a ServiceReference.ClientConfig, I am still hoping that this is not needed. But some of the other discussions make me feel that I might need it - I hope not.

 Thanks, any insights.

Jun 1, 2010 at 8:53 AM
I recommend you obtain the latest version from the Calcium repository. http://calcium.codeplex.com You can also examine the Output window in Visual Studio to identify any Clog specific configuration errors. Cheers, Daniel
Aug 26, 2010 at 9:58 AM

I've just started to look at Clog too. In my case it's in the VSgenerated project demo of Calcium where I have changed the default config over to Log4Net and also using a RollingFileAppender.
And I can't see a file being generated either.
As I am using the Calcium demo, I can see two ways of configing Clog/Log4Net - (a) entries in App.config, (b) the Log4Net.config file in the project
Surely both are not needed - ideally I want to use (a) only.
So it may be that I have configured Clog and as yet not configured log4net.
I can see two strategies and the Console one is writing to VS's output window, but I can see any log file.

I'm sure I'll get to the bottom of it eventually, but if anyone has some words of wisdom, it would be most appreciated

thanks for the great work, Daniel.