Configuring the client logging application

You are assumed to have basic knowledge about log4net, and specifically know just where your application that does the logging, acutally keeps it's log4net configuration.

This may typically be in a <log4net> section of the Web.config or app.config file, or it may be in a separate file, for example EPiServer by convention places it's configuration in a file named EPiServerLog.config .

As usual with log4net, you need to configure an appender, and the refer to it to actually direct logs to it. A typical remoting appender configuration follows:

<appender name="remotingAppender"
          type="log4net.Appender.RemotingAppender" >
    <!-- The remoting URL to the remoting server object -->
    <sink value="tcp://localhost:8085/Log4netRemotingServerService" />
    <!-- Send all events, do not discard events when the buffer is full -->
    <lossy value="false" />
    <!-- The number of events to buffer before sending -->
    <bufferSize value="0" />
    <!-- Do not store event data that is slow to generate -->
    <onlyFixPartialEventData value="true" />
    <!-- Specify an evaluator to send the events immediately under certain conditions, e.g. when an error event ocurrs -->
    <evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="WARN" />
    </evaluator>
</appender>

Note the <sink> element - that's where you specifify the URL of the server where you install the listening Remote Logging Server Service. It might well be localhost as in the example, since it's every useful to consolidate logs from separate application instances in the same physical machine.

Then you need to refer to this appender, like this:

<root>
    <appender-ref ref="remotingAppender" />
</root>

Do remember that you may need to open firewalls for the selected port, in the example above it's port 8085. 

Last edited Sep 3, 2010 at 7:06 AM by svante, version 7

Comments

No comments yet.