1536d4dc5f
SVN-Revision: r1066
40 lines
845 B
C#
40 lines
845 B
C#
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. |