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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:13:39+00:00 2026-05-21T18:13:39+00:00

For reasons I won’t get into I’m forced to configure a log4j appender programmatically.

  • 0

For reasons I won’t get into I’m forced to configure a log4j appender programmatically.

I want to use a RollingFileAppender so I can control the maximum number of files that are kept around.

Also I want to set this appender to use a TimeBasedRollingPolicy as that will automatically take care of compressing the rolled files.

Problem is I can’t see a way to set this through code. When setting up a RollingFileAppender normally through a properties file you would have:

log4j.appender.LOGFILE.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy

There must be a way of setting this …. ? Can anyone shed some light, digging through the javadoc and the basic eclipse-reflection of the classes methods hasn’t revealed the solution 🙁

  • 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-21T18:13:40+00:00Added an answer on May 21, 2026 at 6:13 pm

    You might need the log4j companions/extras to use the rolling.RollingFileAppender.

    http://logging.apache.org/log4j/companions/index.html

    EDIT:

    Here is the api reference that lets you set the rolling policy.

    http://logging.apache.org/log4j/companions/apidocs/org/apache/log4j/rolling/RollingFileAppender.html

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

Sidebar

Related Questions

From reasons I won't get into, all our unit tests are using the VSTS
For reasons I won't go into, I need a COM-based tree control with the
For reasons I won't go into I need to use CLR generics syntax in
For various reasons that I won't go into (I promise it's necessary to do
For reasons I won't go into, I wish to ban an entire company from
I am binding a Winforms Grid to an entity. (For reasons I won't go
For some reason my bind events won't work. You can see my code here:
For reasons that only the developers can understand, Firefox will create and open .url
Any reasons why this can not be standard behavior of free() ? multiple pointers
For reasons beyond my control, I need to return const char* from a function,

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.