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 7772747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:56:58+00:00 2026-06-01T16:56:58+00:00

I’m having trouble understanding the relation between additivity, category logging level and appender threshold.

  • 0

I’m having trouble understanding the relation between additivity, category logging level and appender threshold.

here’s the scenario (my log4j.properties file):

log4j.category.GeneralPurpose.classTypes=INFO, webAppLogger
log4j.additivity.GeneralPurpose.classTypes=true

log4j.category.GeneralPurpose=ERROR, defaultLogger
log4j.additivity.GeneralPurpose=false

log4j.appender.webAppLogger=org.apache.log4j.RollingFileAppender
log4j.appender.webAppLogger.File=webapps/someWebApp/logs/webApp.log
log4j.appender.webAppLogger.MaxFileSize=3000KB
log4j.appender.webAppLogger.MaxBackupIndex=10
log4j.appender.webAppLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.webAppLogger.layout.ConversionPattern=%d [%t] (%F:%L) %-5p - %m%n
log4j.appender.webAppLogger.Encoding=UTF-8

log4j.appender.defaultLogger=org.apache.log4j.RollingFileAppender
log4j.appender.defaultLogger.File=logs/server.log
log4j.appender.defaultLogger.MaxFileSize=3000KB
log4j.appender.defaultLogger.MaxBackupIndex=10
log4j.appender.defaultLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.defaultLogger.layout.ConversionPattern=%d [%t] (%F:%L) %-5p - %m%n
log4j.appender.defaultLogger.Encoding=UTF-8

insights:
category GeneralPurpose.classTypes is INFO
category GeneralPurpose.classTypes has additivity TRUE
category GeneralPurpose is ERROR
category GeneralPurpose has additivity FALSE

with the current configuration I would have assumed that INFO messages sent to category GeneralPurpose.classTypes.* would be only logged to webAppLogger since the parent logger (category) is set with ERROR level logging. However, this is not the case, the message is logged twice (one in each log file). Looks like the ERROR logging level for the parent category is not taken into consideration when the event is sent as part of additivity.

  1. is my observation correct or am I missing something ?
  2. how should I alter the configuration in order to achieve only ERROR level loggings in server.log?
  • 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-06-01T16:56:59+00:00Added an answer on June 1, 2026 at 4:56 pm

    The level of a category determines whether an event originating in that category is logged or discarded; it doesn’t have any filtering effect on events that are received from child categories.

    Since GeneraPurpose.classTypes has a level of INFO, any events less severe than INFO will be discarded, but the remainder will be preserved.

    Since GeneralPurpose.classTypes has an additivity of true, enabled events will be passed on to its parent categories in the hierarchy—specifically including GeneralPurpose.

    Since the threshold is not set on the webAppLogger, it will log all events it receives.

    Since the threshold is not set on the defaultLogger, it will log all events it receives.

    If you want the defaultLogger to include only ERROR events or worse, set its threshold to ERROR.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.