/log4mongo-net

Originally forked from: log4net appender to MongoDB database.

Primary LanguageC#BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

MongoDB appender for log4net.

(Ronin West/OverNear fork)

The title says it all. Check Log4Net site or MongoDB site if you need more info.

This is the UN-official .NET implementation for the log4mongo project. Remvoing all compilation time warnings, TestDriven NUnit execution issues & added configuration sharding support!

Installation

Download sources and run build.cmd to build

Appender configuration sample

<appender name="MongoDBAppender" type="Log4Mongo.MongoDBAppender, Log4Mongo">
	<!-- 
	MongoDB database connection in the format:
	mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
	See http://www.mongodb.org/display/DOCS/Connections for connectionstring options 
	If no database specified, default to "log4net"
	-->
	<connectionString value="mongodb://localhost/log4net" />
	<!-- 
	Name of the collection in database
	Optional, Defaults to "logs"
	-->
	<collectionName value="logs" />
	<!--
		_id is default (thanks to MongoDB), any field can be used as a shard key.
		_id is ideal for smaller project w/ a small number of logger. For a larger project, logger is recommened as the shardkey!
	-->
	<shardKey value='_id' />
	<field>
		<name value="timestamp" />
		<layout type="log4net.Layout.RawTimeStampLayout" />
	</field>
	<field>
		<name value="level" />
		<layout type="log4net.Layout.PatternLayout" value="%level" />
	</field>
	<field>
		<name value="thread" />
		<layout type="log4net.Layout.PatternLayout" value="%thread" />
	</field>
	<field>
		<name value="logger" />
		<layout type="log4net.Layout.PatternLayout" value="%logger" />
	</field>
	<field>
		<name value="message" />
		<layout type="log4net.Layout.PatternLayout" value="%message" />
	</field>
	<field>
		<name value="mycustomproperty" />
		<layout type="log4net.Layout.RawPropertyLayout">
			<key value="mycustomproperty" />
		</layout>
	</field>
</appender>

License

BSD 3