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

If I had a non-anonymous class like this, I know I can use DisplayNameAttribute
For some reason jQuery won't load on my website. I've tried it in google
For some reason, this configuration of an ExtJS4 grid won't update. When you click
This code won't work. I've had everything echoed and it displays fine on the
From past readings it seems most 32 bit drivers won't work on 64 bit.
I'm currently working on an upgrade to a project that extensively uses COM /
I'm quite used to PHP5 but have to write a PHP4 sync script, now
I'm using a simple XOR input and output data set in order to train
I wrote a program to make a graphical Timeline and it works through some
We have a problem with our current TFS installation. For some reason, which I

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.