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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:12:24+00:00 2026-06-11T10:12:24+00:00

I am using log4j for logging in my applicaion. I am trying to different

  • 0

I am using log4j for logging in my applicaion. I am trying to different level logs in different files but something going wrong. Any help regrading this issue will be highly appreciated.

    <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="console" class="org.apache.log4j.ConsoleAppender"> 
    <param name="Target" value="System.out"/> 
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/> 
    </layout> 
</appender> 

<appender name="DEBUG" class="org.apache.log4j.RollingFileAppender">
  <param name="File" value="TCS_patch_9/log/retailer_debug.log" />
  <param name="Threshold" value="DEBUG" />
  <param name="MaxFileSize" value="2MB"/>
  <param name="MaxBackupIndex" value="3"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
  </layout>
</appender>

<appender name="INFO" class="org.apache.log4j.RollingFileAppender">
  <param name="File" value="TCS_patch_9/log/retailer_info.log" />
  <param name="Threshold" value="INFO" />
  <param name="MaxFileSize" value="2MB"/>
  <param name="MaxBackupIndex" value="3"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
  </layout>
</appender>
<appender name="ERROR" class="org.apache.log4j.RollingFileAppender">
  <param name="File" value="TCS_patch_9/log/retailer_error.log" />
  <param name="Threshold" value="ERROR" />
  <param name="MaxFileSize" value="2MB"/>
  <param name="MaxBackupIndex" value="3"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
  </layout>
</appender>
<appender name="FATAL" class="org.apache.log4j.RollingFileAppender">
  <param name="File" value="TCS_patch_9/log/retailer_repeat_delay.log" />
  <param name="Threshold" value="FATAL" />
  <param name="MaxFileSize" value="2MB"/>
  <param name="MaxBackupIndex" value="3"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
  </layout>
</appender>

  <root> 
    <priority value ="error" /> 
    <appender-ref ref="console"/> 
    <appender-ref ref="DEBUG"/> 
    <appender-ref ref="INFO"/> 
    <appender-ref ref="ERROR"/>
    <appender-ref ref="FATAL"/> 
  </root>

</log4j:configuration>
  • 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-11T10:12:26+00:00Added an answer on June 11, 2026 at 10:12 am

    The standard behaviour for log4j appenders is that they log all messages at their threshold level or higher, i.e. an appender with threshold INFO will log INFO, WARN, ERROR and FATAL messages but not DEBUG. If you want to log only INFO messages but not WARN and above then you need to use a LevelMatchFilter.

    You will also need to set your root logger priority to DEBUG, otherwise it will only send ERROR and FATAL messages to its appenders and your DEBUG and INFO files will be empty.

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

Sidebar

Related Questions

I'm using Apache Commons Logging and SLF4J with log4j, but I also want to
My java application uses log4j for logging. Using ant the project builds successfully, but
I am using Log4j for logging output of my application. The log4j.properties files contents
I have discovered some issues in my program. I was using log4j for logging,
I'm working on a project and we want to handle our logging using log4j.
I've using SLF4j as my logging framework, backed by log4j. My problem is that
We are using log4j+commons-logging in our current projects. Now we are mirgrating from log4j
Using log4j, I used to have an appender that logs directly to one of
I'm using log4j in an app I'm developing to eventually run inside Tomcat/JBoss, but
I have sixteen servers using Log4J logs, accessible by ssh. I want to see

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.