Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

Daily log4net appender

Wednesday, March 21, 2012 Ma Nu 0 Comments

One of our more interesting server logs is the "ChannelCall" logger. It gives you a full detailed information about all the server requests. If you set it to DEBUG you will be able to check the following data for each incoming client call:

  • Bytes received.
  • Time to receive the message.
  • Bytes sent.
  • Time to execute the operation invoked (ms)
  • Operation invoqued.
  • Client machine IP.
  • Thread to attend the call.

This is an example of how it looks like:

2012-03-16 14:43:16,783   INFO  ChannelCall - |1638|0|2051|0| proc 47 | ExecuteSimpleQuery | 127.0.0.1 | 13

It's very useful to determine if a call is taking too much time to execute an operation and diagnose performance problems. For example, a log entry with a proc time like this proc 1200000 creating a branch obviously is not a good time, unless you are using Perforce.

The problem with this kind of log is that if your company has a big number of developers. Let's say 500, the number of incoming calls is going to be huge and the log file is going to grow and grow without control, you will find yourself dealing with a 3GB text file... A 3GB file is almost unmanageable and it's hard to find something relevant inside it. I want to show you how to configure a log4net appender that will generate a log file everyday, smaller, simpler, and it's obviously categorized by day.

...
<appender name="ChannelCallDailyFileAppender" type="log4net.Appender.RollingFileAppender">
    <lockingmodel type="log4net.Appender.FileAppender"/>
    <file value="ChannelCall.log." />
    <appendtofile value="true" />
    <staticlogfilename value="false" />
    <rollingstyle value="Date" />
    <datepattern value="yyyy.MM.dd-HH.mm'.txt'" />
    <layout type="log4net.Layout.PatternLayout">
        <conversionpattern value="%date  %-5level %logger - %message%newline" />
    </layout>
</appender>
...

Note that this appender creates, if the program is generating log info constantly, a new log file every minute, you can must change it to diary mode with this date pattern: "yyyy.MM.dd". Otherwise we will have a crazy bunch of little log files. This is only an example to show you how the log files are created without having to wait one hour to see the result.

Let's use our brand new daily channel call log appender:

...
<logger name="ChannelCall">
        <level value="DEBUG" />
        <appender-ref ref="ChannelCallDailyFileAppender" />
</logger>
...

You can user the new appender and logger inside your "loader.log.conf" file inside the Plastic SCM server installation directory. Here you can find more information about the Plastic SCM log.

Enjoy!



Manuel Lucio
I'm in charge of the Customer Support area.
I deal with complex setups, policies and working methodologies on a daily basis.
Prior to taking full responsibility of support, I worked as software engineer. I have been in charge of load testing for quite some time, so if you want to know how well Plastic compares to SVN or P4 under a really heavy load, I'm your guy.
I like to play with Arduino GPS devices, mountain biking and playing tennis.
You can find me hooked to my iPhone, skate-boarding or learning Korean... and also here @mrcatacroquer.

0 comentarios: