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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:19:15+00:00 2026-05-12T21:19:15+00:00

I have an automated integration test harness and would like to streamline the logging

  • 0

I have an automated integration test harness and would like to streamline the logging (which is implemented using log4j)

I have a number of high-level tests, each with an id and require a separate log file per test. As the tests are created randomly the ids are not known until runtime.

Therefore I would like to ensure that logging within each high-level test is written out to the log file for that test.

I don’t want to create custom log levels, neither do I want to have logging sent to all appenders.

Does anyone know a way of doing this?

  • 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-12T21:19:15+00:00Added an answer on May 12, 2026 at 9:19 pm

    You can easily invoke log4j’s API programmatically, e.g.

    FileAppender appender = new FileAppender();
    // configure the appender here, with file location, etc
    appender.activateOptions();
    
    Logger logger = getRootLogger();
    logger.addAppender(appender);
    

    The logger can be the root logger as in this example, or any logger down the tree. Your unit test can add its custom appender during steup, and remove the appender (using removeAppender()) during teardown.

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

Sidebar

Related Questions

For automated testing (using Hudson) I have a script that generates a bunch of
I have been using Selenium Library with Robot Framework for writing automated tests for
I would like to make integration tests and system tests for my applications but
We have multiple Hudson continuous integration environments set up with automated builds and tests,
I would like an automated web tests suite based on Selenium RC to take
I have a lot of integration tests which read expected results from files. My
We're finding it very cumbersome to develop automated nunit integration tests which require domain
I'm currently using jenkins/hudson for continuous integration a large mostly C++ project. We have
I am building a Backbone app and I need to have automated tests. I
I have successfully automated the process of creating a new IIS website, however the

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.