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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:12:40+00:00 2026-06-07T23:12:40+00:00

I am attempting to use log4j to write CSV files. The CSV header must

  • 0

I am attempting to use log4j to write CSV files. The CSV header must be written to the top of a log file every time it is created. For example, all of these rolled files must have the following as the first line in the log file:

log.0 Timestamp, Name, min, max

log.1 Timestamp, Name, min, max

log.2 Timestamp, Name, min, max

Is it possible to determine when a rollover has occurred so that I can append the header?

Thanks.

P.S: I know there are lots of open source CSV writers but I prefer not to use them because I would like to use the existing log functionality in our software.

  • 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-07T23:12:42+00:00Added an answer on June 7, 2026 at 11:12 pm

    If you look at log4j documentation for RollingFileAppender, it has a method called rollOver.

    http://logging.apache.org/log4j/1.2/apidocs/index.html

    You would need to implement a custom file appender that inherits from RollingFileAppender, and override the rollOver method. I imagine you could just call super.rollOver, and then write whatever you want as a header to the new file before anything gets logged to it.

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

Sidebar

Related Questions

When attempting to use pandoc to convert JSON based files (.ipynb) from iPython notebook
I'm attempting to use MIB files in PySNMP. The code is fairly straightforward. Nothing
I'm attempting to use mod_rewrite to redirect requests to 123.example.com/456/file.html to example.com/123/456/file.html . The
Attempting to use asp.net mvc's Action Result of File. So it would seem that
I'm attempting to use wget to recursively grab only the .jpg files from a
I am attempting to use the 'tempfile' module for manipulating and creating text files.
I am attempting to use Inno Setup to bootstrap a WiX generated .msi file
I'm attempting to use the getc() function to copy the contents of one file
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng

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.