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

  • Home
  • SEARCH
  • 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 311417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:55:23+00:00 2026-05-12T07:55:23+00:00

In my log4j.properties I have: log4j.rootLogger=DEBUG,stdout log4j.logger.notRootLogger=DEBUG,somewhereelse The appenders stdout and somewhereelse are both

  • 0

In my log4j.properties I have:

log4j.rootLogger=DEBUG,stdout

log4j.logger.notRootLogger=DEBUG,somewhereelse

The appenders stdout and somewhereelse are both configured properly, stdout writes to the console and somewhereelse writes to a file.

In my code in each class either I set either:

static Logger log =  Logger.getLogger("notRootLogger);

^ When I don’t want stuff going to the console.

-OR-

static Logger log = Logger.getRootLogger();

^ When I do.

What do I have to do in log4.properties to stop the things that are written to notRootLogger ending up in stdout? Is there some sort of inheritance of wherever the root logger writes to going on that needs to be turned off somehow?

I don’t want to have to configure a logger for every single class individually that I just want to log to the console.

  • 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-12T07:55:23+00:00Added an answer on May 12, 2026 at 7:55 am

    You need to set additivity = false, IIRC. From the log4j manual:

    Each enabled logging request for a
    given logger will be forwarded to all
    the appenders in that logger as well
    as the appenders higher in the
    hierarchy. In other words, appenders
    are inherited additively from the
    logger hierarchy. For example, if a
    console appender is added to the root
    logger, then all enabled logging
    requests will at least print on the
    console. If in addition a file
    appender is added to a logger, say C,
    then enabled logging requests for C
    and C’s children will print on a file
    and on the console. It is possible to
    override this default behavior so that
    appender accumulation is no longer
    additive by setting the additivity
    flag to false.

    Try this:

    log4j.rootLogger=DEBUG,stdout
    log4j.logger.notRootLogger=DEBUG,somewhereelse
    log4j.additivity.notRootLogger=false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following on my log4j.properties log4j.rootLogger = debug, stdout, fileLog log4j.appender.stdout =
how can i configure a log4j.properties with a rootlogger = debug, stdout, logfile and
I have an application for which log4j logging is configured in a log4j.properties file.
In logging frameworks like log4j & log4net you have the ability to log various
We have a java web service application that uses log4j to do logging. An
I've got a log4J setup in which the root logger is supposed to log
While running the application i do not able to set the jndi.properties and log4j.properties
I'm trying to figure out how I can manage my log4j.properties file with leiningen.
The log4j network adapter sends events as a serialised java object. I would like
In Log4j, there is a feature wherein the system can be initialized to do

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.