Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

log4net centralised logging for multiple components

We are using log4net with rolling file appender.

As we are using load balancing servers log files are generated on both the of the servers and looking at them is of a lot problem.

We are thinking of some centralisied logging which can hold all the logs of different components at one place and if required can be viewed with some log viewer or a customised UI.

We have some proposed solutions to it

  1. ADO appender
  2. WCF appender
  3. MSMQ appender where we send message to msmq and some windows service which will pick up the messages from msmq and place it in log files.

More suggestion please post it..

like image 508
Miral Avatar asked Jan 11 '10 10:01

Miral


People also ask

Does log4net support structured logging?

log4net doesn't support the concept of structured logging. Like shown in the conversionPattern element in the XML configuration, you have some variables to play with when writing to the storage. But including properties like FirstName in the Serilog example isn't available.

Is log4net dependent on log4j?

Log4net is a logging utility for . NET applications. It's based on log4j, which is for Java applications. Log4net is highly configurable, so you can use it in many scenarios.

What are the main components of log4net briefly describe how loggers work in log4net?

Log4net has three main components: loggers, appenders and layouts. These three types of components work together to enable developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported.


2 Answers

A simple solution is to use Syslog, using the RemoteSyslogAppender

Once you have a Syslog server setup you can use this 'out of the box', with no need for the additional work required using ADO, WCF or MSMQ

A good Syslog server for Windows is Kiwi, with both free and commercial (has more functionality than the free version) versions available. Kiwi comes with a viewer as well.

like image 96
Cocowalla Avatar answered Oct 11 '22 10:10

Cocowalla


You can use, for example, a UdpAppender or a RemotingAppender to send the logged events over a network to a central point which logs them to disk. Note that the UDP version can drop messages under heavy network load, as UDP does not offer delivery guarantees.

Alternatively, you could base a TcpAppender class on UdpAppender which uses TCP rather than UDP - providing a reliable delivery service.

like image 2
Vinay Sajip Avatar answered Oct 11 '22 12:10

Vinay Sajip