Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6735065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:57:50+00:00 2026-05-26T10:57:50+00:00

When you have 2 appenders, say one for debug errors and one for product

  • 0

When you have 2 appenders, say one for debug errors and one for product errors, in your code, do you explicitly create 2 log classes or is an appender basically going to write any log messages that meet a certain criteria?

So in your code, you use a single log method, and depending on how your appenders are setup, it will log the message if it e.g. is logged from a specific namespace, or is a certain log level.

So its possible a single log entry is written to 2 log files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:57:50+00:00Added an answer on May 26, 2026 at 10:57 am

    Yes, you can have single log statements post to multiple appenders. As long as it meets the criteria for each, it will use each appender.

    For example, take this config section, it logs all messages to file, and also logs warnings and errors to event viewer.:

     <log4net>
        <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
          <file value="c:\logs\MySite"/>
          <appendToFile value="true"/>
          <datePattern value=".yyyy-MM-dd.\l\o\g"/>
          <rollingStyle value="Date"/>
          <MaxSizeRollBackups value="14"/>
          <param name="StaticLogFileName" value="false"/>
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%d{HH:mm:ss.fff} [%thread] %-5level %logger{1} - %m%n"/>
          </layout>
        </appender>
        <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
          <applicationName value="Trading.Web"/>
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%d{HH:mm:ss.fff} [%thread] %-5level %logger{1} - %m%n"/>
          </layout>
          <filter type="log4net.Filter.LevelRangeFilter">
            <param name="LevelMin" value="WARN"/>
            <param name="LevelMax" value="ERROR"/>
          </filter>
        </appender>
        <root>
          <level value="DEBUG"/>
          <appender-ref ref="RollingFileAppender"/>
          <appender-ref ref="EventLogAppender" />
        </root>
      </log4net>
    

    So this:

      _log.Debug("This is a debug message");
    

    Will only appear in the log file (because it doesn’t meet the event log appender’s filter criteria).

    But this:

      _log.Error("This is an error message.");
    

    Will log to both the log file and the event viewer.

    UPDATE: On your filtering question, if you had:

    <root>
      <level value="DEBUG"/>
      <appender-ref ref="RollingFileAppender"/>
    </root>
    
    <!-- Print only messages of level WARN or above in the namespace Com.Foo -->
    <logger name="Com.Foo">
        <level value="WARN" />
    </logger>
    

    Then all things under Com.Foo will log if WARN or higher, but everything else would log at DEBUG or higher….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have the following JavaScript/jQuery code below function createElement(i, value) { return
I have a sinks::text_file_backend sink. Say I already have a few rotated log files:
I have an appender that I only want the first X characters (for this
Right now for my ConversionPattern I have: log4j.appender.A1.layout.ConversionPattern=%d{yyyy MMM dd HH:mm:ss,SSS} %5p [%t] (%F:%L)
I have configured a SMTP appender to send an email whenever there's an error.
I have a rolling file appender configured with this: <appender name=RollingLogFileAppender type=log4net.Appender.RollingFileAppender> <file value=appname
I have a c++ application which logs to some file using log4cxx (RollingFile appender).
I have a java app that uses log4j. Config: log4j.rootLogger=info, file log4j.appender.file=org.apache.log4j.DailyRollingFileAppender log4j.appender.file.File=${user.home}/logs/app.log log4j.appender.file.layout=org.apache.log4j.PatternLayout
I have the following log4j.xml configuration: <log4j:configuration> <appender name = CONSOLE class = org.apache.log4j.ConsoleAppender>
Okay so I have the following Code which appends a string to another in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.