SVN r1066
SVN-Revision: r1066
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using log4net.Layout;
|
||||
using log4net.Layout.Pattern;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.Util
|
||||
{
|
||||
public class MyLayout : PatternLayout
|
||||
{
|
||||
|
||||
public MyLayout()
|
||||
{
|
||||
|
||||
this.AddConverter("property", typeof(MyPatternConverter));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class MyPatternConverter : PatternLayoutConverter
|
||||
{
|
||||
|
||||
protected override void Convert(System.IO.TextWriter writer, log4net.Core.LoggingEvent loggingEvent)
|
||||
{
|
||||
|
||||
if (Option != null)
|
||||
{
|
||||
|
||||
WriteObject(writer, loggingEvent.Repository, LookupProperty(Option, loggingEvent));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 写入所有关键值对
|
||||
|
||||
WriteDictionary(writer, loggingEvent.
|
||||
Reference in New Issue
Block a user