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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:31:40+00:00 2026-06-14T09:31:40+00:00

When running tests using maven , i’d like to see output on my screen.

  • 0

When running tests using maven, i’d like to see output on my screen.

After putting the log4j.xml into my project’s dir (src/test/resources/cfg/), i updated my pom to include

235             <plugin>
236                 <groupId>org.apache.maven.plugins</groupId>
237                 <artifactId>maven-surefire-plugin</artifactId>
238                 <configuration>
239                     <skipTests>false</skipTests>
240                     <excludes>
241                         <exclude>**/*$*.java</exclude>
242                     </excludes>
243                         <systemProperties>
244                            <property>
245                               <name>-Dlog4j.configuration</name>
246                               <value>file:src/test/resources/cfg/log4j.xml</value>
247                            </property>
248                         </systemProperties>
249                     <additionalClasspathElements>
250                         <additionalClasspathElement>src/test/resources/cfg/</additionalClasspathElement>
251                     </additionalClasspathElements>
252                 </configuration>
253             </plugin>

The above does not work. When tests run, i still see the following message

log4j:WARN Please initialize the log4j system properly.

For the record, the following is the log4j

  1 <?xml version="1.0" encoding="UTF-8" ?>
  2 <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  3 
  4 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  5   <appender name="console" class="org.apache.log4j.ConsoleAppender">
  6     <param name="Target" value="System.out"/>
  7     <layout class="org.apache.log4j.PatternLayout">
  8       <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
  9     </layout>
 10   </appender>
 11 
 12   <root>
 13     <priority value ="debug" />
 14     <appender-ref ref="console" />
 15   </root>
 16 
 17 </log4j:configuration>

What am i missing please?

  • 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-14T09:31:41+00:00Added an answer on June 14, 2026 at 9:31 am

    I have a couple of comments. First, I recommend that you put any test-related log4j, logback config files directly in src/test/resources. That way they are always added to the classpath and it just works.

    However, if you need to put the files in src/test/resources/cfg and want to use the classpathelements, then heed the advice of the documentation

    But, if you must, you can use the additionalClasspathElements element to add custom resources/jars to your classpath. This will be treated as an absolute file system path, so you may want use ${basedir} or another property combined with a relative path.

    So try:

    <additionalClasspathElement>${basedir}/src/test/resources/cfg/</additionalClasspathElement>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After I run a bunch of Selenium (jUnit4) tests using Maven, I'd like to
I'm working on a project using Scala running Selenium tests as part of a
I need run all tests from my multimodule project using IDE. Like I do
I'm using the hibernate3-maven-plugin to generate my schema before running tests, and it is
I'm using the jasmine maven plugin and my pom.xml looks like this: <plugin> <groupId>com.github.searls</groupId>
I am running my Integration Tests using maven and the failsafe plugin. The tests
We're using the maven-surefire-plugin to run our Java tests. The tests fall into two
I'm using Netbeans with Maven and TestNG. When running tests with the maven surefire
When running some tests I came across the following issue. When using: private String
We have some unit tests running against a SQL server 2000 database using 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.