logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parrish, Ken" <KParr...@gomez.com>
Subject Reusable layouts ...
Date Fri, 07 Mar 2008 16:44:26 GMT
Is there a way in a log4net configuration file to specify a layout
pattern and then reference that pattern from multiple appenders.  In the
following config file snippet, the same layout specification is used by
two different appenders.  Is there a way to specify the pattern just
once and reference that patter by each of the two appenders?

 

Thanks,

 

Ken Parrish

Gomez, Inc.

 

<!-- Standard rolling file appender -->
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
      <file value="RollingFile.log" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%date{yyyy-MM-dd
HH:mm:ss.fff} [%t] %-5level %logger - %message%newline%exception" />
      </layout>
</appender>

<!-- Windows Application Event Log appender -->
<appender name="EventLogAppender"
type="log4net.Appender.EventLogAppender">
      <applicationName value="MyApplication" />
      <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%date{yyyy-MM-dd
HH:mm:ss.fff} [%t] %-5level %logger - %message%newline%exception" />
      </layout>
</appender>




 


Mime
View raw message