1)

 <appender name="SystemLog" type="log4net.Appender.FileAppender">
 <filter type="log4net.Filter.LevelMatchFilter">
  <levelToMatch value="INFO" />
 </filter>
 ...
 </appender>

2) 

I'm don't understand your "real-time logger" description. Could you
give another example or some sample calls and what the results would
look like when written to a FileAppender?

Here is a link to the PatterLayout class' documentation showing it's
available patterns:

http://tinyurl.com/e3nd3
http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html

-- Russell Haley <[EMAIL PROTECTED]> wrote:

> I want to start by thanking Nicko Cadell for his previous response to
> this
> problem. I'm very pleased that there is a place to find answers for
> Log4Net.
> I was able to configure my appenders to work in tandem, but I still
> have an
> issue.
> 
> 1) I have created 2 custom appenders that are to log different
> message
> levels that are returned from my application. One appender is to
> record all
> logging levels, while the other is to log ONLY the "Info" entries.
> Nicko
> Cadell suggested I use the Threshold property and assign a value of
> "Info".
> My observation, however, is that the appender with the threshold of
> "Info"
> logs everything but "Debug" statements. As usual, I'm sure I've
> simply
> missed something.
> 
> The following is my config file listing:
> 
> <log4net>
>               <appender name="SystemEventInfoLog"
> type="log4net.Appender.RollingFileAppender">
>                       <param name="File" value="../logging/" />
>                       <param name="AppendToFile" value="true" />
>                       <param name="RollingStyle" value="Date" />
>                       <param name="MaxSizeRollBackups" value="10" />
>                       <param name="DatePattern"
> value="yyyy/MMMMMMMMM/yyyy-MM-dd.\\I\\N\\F\\O"/>
>                       <param name="StaticLogFileName" value="False" />
>                       <param name="Threshold" value="INFO" />
>                       <layout type="log4net.Layout.PatternLayout">
>                           <param name="Header" value="[BEGIN LOGGING]\r\n" />
>                               <param name="Footer" value="[END LOGGING]\r\n" 
> />
>                               <param name="ConversionPattern" value="%d [%t] 
> %-5p %c [%x] -
> %m%n" />
>                       </layout>
>               </appender>
>               <appender name="SystemLog"
> type="log4net.Appender.RollingFileAppender">
>                       <param name="File" value="../logging/" />
>                       <param name="Threshold" value="ALL" />
>                       <param name="AppendToFile" value="true" />
>                       <param name="RollingStyle" value="Date" />
>                       <param name="MaxSizeRollBackups" value="10" />
>                       <param name="DatePattern"
> value="yyyy/MMMMMMMMM/yyyy-MM-dd.\\S\\Y\\S\\T\\E\\M"/>
>                       <param name="StaticLogFileName" value="False" />
>                       <layout type="log4net.Layout.PatternLayout">
>                           <param name="Header" value="[BEGIN LOGGING]\r\n" />
>                               <param name="Footer" value="[END LOGGING]\r\n" 
> />
>                               <param name="ConversionPattern" value="%d [%t] 
> %-5p %c [%x] -
> %m%n" />
>                       </layout>
>               </appender>
> 
>               <!-- Set root logger level to DEBUG and its only appender to A1 
> -->
>               <root>
>                       <appender-ref ref="SystemLog" />
>                       <appender-ref ref="SystemEventInfoLog"/>
>               </root>
>       </log4net>
> 
> 2)  I would like to create another totally different logger and any
> design
> input would be most appreciated.
> 
> The "new" logger/appender will log real-time messages to whatever
> appender
> the user chooses and will have a very specific format (real-time
> being a
> min. of 1 second and no max). The data to be logged is mainly date
> time,
> message type (a constant value I will assign to each message that
> comes in)
> and the message content. I do not need to assign a log level to these
> entries and would prefer to not have to deal with log level in my
> files. The
> application can have a number of "Systems" that return real-time
> messages
> and I would like to be able to log the messages for each system in a
> separate file (or table) that will use the "System ID " to demark the
> folder
> and filename that is created. Unfortunately my experience with
> formatters/layout/objectRenderer is very thin. Does anyone have any
> feedback
> for this? I assume that I will have to dynamically configure the
> logger/appender in my code. Will I need to alter the log4net source
> to
> achieve this sort of functionality?
> 
> On a side note, is there a list of ConversionPattern Constants? (i.e.
> %d
> [%t] %-5p ...) How about appender parameters?
> 
> Thanks once again to the Log4Net team. I hope that with a little more
> experience I will be able to start contributing in some way to this
> great
> piece of software, instead of just crying for help. :)
> 
> Sincerely,
> 
> Russell Haley
> Software Developer,
> Axys Technologies
> http://www.axystechnologies.com
> 
> 
> 
> 

Reply via email to