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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:53:32+00:00 2026-05-31T01:53:32+00:00

I can’t figure out how to configure my log4j so that my debugLog and

  • 0

I can’t figure out how to configure my log4j so that my debugLog and my reportsLog are separate from each other (not additive). Why is it, that in the configuration below, the reportsLog is always empty?

log4j.rootLogger=TRACE, stdout, debugLog

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n

log4j.appender.debugLog=org.apache.log4j.FileAppender
log4j.appender.debugLog.File=logs/debug.log
log4j.appender.debugLog.layout=org.apache.log4j.PatternLayout
log4j.appender.debugLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n

log4j.reportsLog=DEBUG,reportsLog
log4j.appender.reportsLog=org.apache.log4j.FileAppender
log4j.appender.reportsLog.File=logs/reports.log
log4j.appender.reportsLog.layout=org.apache.log4j.PatternLayout
log4j.appender.reportsLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n

And here is my Java code:

package test;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class HelloLogger {

    static final Logger debugLog = Logger.getLogger("debugLog");
    static final Logger resultLog = Logger.getLogger("reportsLog");

    public static void main(String[] args) {
        PropertyConfigurator.configure("log4j.properties");
        debugLog.debug("Hello debugLog message");   
        resultLog.debug("Hello reportsLog message");
    }   
}
  • 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-31T01:53:33+00:00Added an answer on May 31, 2026 at 1:53 am

    Try the following configuration:

    log4j.rootLogger=TRACE, stdout
    
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n
    
    log4j.appender.debugLog=org.apache.log4j.FileAppender
    log4j.appender.debugLog.File=logs/debug.log
    log4j.appender.debugLog.layout=org.apache.log4j.PatternLayout
    log4j.appender.debugLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n
    
    log4j.appender.reportsLog=org.apache.log4j.FileAppender
    log4j.appender.reportsLog.File=logs/reports.log
    log4j.appender.reportsLog.layout=org.apache.log4j.PatternLayout
    log4j.appender.reportsLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n
    
    log4j.category.debugLogger=TRACE, debugLog
    log4j.additivity.debugLogger=false
    
    log4j.category.reportsLogger=DEBUG, reportsLog
    log4j.additivity.reportsLogger=false
    

    Then configure the loggers in the Java code accordingly:

    static final Logger debugLog = Logger.getLogger("debugLogger");
    static final Logger resultLog = Logger.getLogger("reportsLogger");
    

    Do you want output to go to stdout? If not, change the first line of log4j.properties to:

    log4j.rootLogger=OFF
    

    and get rid of the stdout lines.

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

Sidebar

Related Questions

Can't seem to figure out what's wrong with the simple getJSON call below. It's
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
Can we change the color of the divider? Apple documentations says, that we can
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Can anyone help me as what is going wrong here? Am not able to
Can I prevent an .apk from being installed if unknown sources is checked?
Can any one help me in sorting this out in sed/awk/perl Input file Start
Can someone access the database files and/or other files of my app stores 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.