Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banner printed 4 times with log4j2 #3186

Closed
nyg opened this issue Jul 13, 2023 · 5 comments
Closed

Banner printed 4 times with log4j2 #3186

nyg opened this issue Jul 13, 2023 · 5 comments

Comments

@nyg
Copy link

nyg commented Jul 13, 2023

Hello,

I created an example project, using log4j2 as the logging framework with a basic log4j2.xml config: https://git.sr.ht/~nyg/example-java-serenity.

When I run mvn clean install, the Serenity banner is printed 4 times while the “Test started” is printed twice.

Is this a bug or an issue with my log4j2 config?

Thanks,
nyg

log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
  <Appenders>
      <Console name="Console" target="SYSTEM_OUT">
          <PatternLayout pattern="XXX %d{HH:mm:ss.SSS} [%t] %-5level [%logger{36}] %msg%n"/>
      </Console>
  </Appenders>
  <Loggers>
      <Root level="INFO">
          <AppenderRef ref="Console"/>
      </Root>
  </Loggers>
</Configuration>
mvn clean install
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< edu.self.nyg.example:serenity >--------------------
[INFO] Building serenity 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ serenity ---
[INFO] Deleting /Users/user/Documents/dev/java/example-serenity/target
[INFO] 
[INFO] --- resources:3.3.0:resources (default-resources) @ serenity ---
[INFO] skip non existing resourceDirectory /Users/user/Documents/dev/java/example-serenity/src/main/resources
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ serenity ---
[INFO] No sources to compile
[INFO] 
[INFO] --- resources:3.3.0:testResources (default-testResources) @ serenity ---
[INFO] Copying 1 resource
[INFO] 
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ serenity ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 2 source files with javac [debug release 17] to target/test-classes
[INFO] 
[INFO] --- surefire:3.1.2:test (default-test) @ serenity ---
[INFO] 
[INFO] --- jar:3.3.0:jar (default-jar) @ serenity ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/user/Documents/dev/java/example-serenity/target/serenity-1.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- failsafe:3.1.2:integration-test (default) @ serenity ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
XXX 21:35:59.219 [main] INFO  [] 

-------------------------------------------------------------------------------------
   _______. _______ .______       _______ .__   __.  __  .___________.____    ____ 
  /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   / 
 |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /  
  \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/   
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |     
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|    
                                                                                   
News and tutorials at http://www.serenity-bdd.info                                  
Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/             
Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core 
Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport  
-------------------------------------------------------------------------------------

XXX 21:35:59.230 [main] INFO  [] 

-------------------------------------------------------------------------------------
   _______. _______ .______       _______ .__   __.  __  .___________.____    ____ 
  /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   / 
 |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /  
  \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/   
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |     
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|    
                                                                                   
News and tutorials at http://www.serenity-bdd.info                                  
Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/             
Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core 
Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport  
-------------------------------------------------------------------------------------

XXX 21:35:59.246 [main] INFO  [] Test Suite Started: SimpleIT
XXX 21:35:59.246 [main] INFO  [] Test Suite Started: SimpleIT
[INFO] Running edu.self.nyg.example.junit.SimpleIT
XXX 21:35:59.450 [main] INFO  [] 

-------------------------------------------------------------------------------------
   _______. _______ .______       _______ .__   __.  __  .___________.____    ____ 
  /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   / 
 |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /  
  \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/   
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |     
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|    
                                                                                   
News and tutorials at http://www.serenity-bdd.info                                  
Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/             
Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core 
Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport  
-------------------------------------------------------------------------------------

XXX 21:35:59.452 [main] INFO  [] Test Suite Started: SimpleIT
XXX 21:35:59.452 [main] INFO  [] Test Suite Started: SimpleIT
XXX 21:35:59.465 [main] INFO  [] 
_____   ___   ___   _____     ___   _____     _     ___   _____   ___   ___  
|_   _| | __| / __| |_   _|   / __| |_   _|   /_\   | _ \ |_   _| | __| |   \ 
 | |   | _|  \__ \   | |     \__ \   | |    / _ \  |   /   | |   | _|  | |) |
 |_|   |___| |___/   |_|     |___/   |_|   /_/ \_\ |_|_\   |_|   |___| |___/ 

test()([engine:junit-jupiter]/[class:edu.self.nyg.example.junit.SimpleIT]/[method:test()])
--------------------------------------------------------------------------------
XXX 21:35:59.465 [main] INFO  [] 
_____   ___   ___   _____     ___   _____     _     ___   _____   ___   ___  
|_   _| | __| / __| |_   _|   / __| |_   _|   /_\   | _ \ |_   _| | __| |   \ 
 | |   | _|  \__ \   | |     \__ \   | |    / _ \  |   /   | |   | _|  | |) |
 |_|   |___| |___/   |_|     |___/   |_|   /_/ \_\ |_|_\   |_|   |___| |___/ 

test()([engine:junit-jupiter]/[class:edu.self.nyg.example.junit.SimpleIT]/[method:test()])
--------------------------------------------------------------------------------
|-- step that does something
|-- step that does something
XXX 21:35:59.556 [main] INFO  [edu.self.nyg.example.junit.MyStepLib] doing something
doing something
|-- step that does something else
|-- step that does something else
XXX 21:35:59.582 [main] INFO  [edu.self.nyg.example.junit.MyStepLib] doing something else
doing something else
XXX 21:35:59.603 [main] INFO  [] 
_____   ___   ___   _____     ___     _     ___   ___   ___   ___  
|_   _| | __| / __| |_   _|   | _ \   /_\   / __| / __| | __| |   \ 
 | |   | _|  \__ \   | |     |  _/  / _ \  \__ \ \__ \ | _|  | |) |
 |_|   |___| |___/   |_|     |_|   /_/ \_\ |___/ |___/ |___| |___/ 

Test
----------------------------------------------------------------------
XXX 21:35:59.604 [main] INFO  [] 
_____   ___   ___   _____     ___     _     ___   ___   ___   ___  
|_   _| | __| / __| |_   _|   | _ \   /_\   / __| / __| | __| |   \ 
 | |   | _|  \__ \   | |     |  _/  / _ \  \__ \ \__ \ | _|  | |) |
 |_|   |___| |___/   |_|     |_|   /_/ \_\ |___/ |___/ |___| |___/ 

Test
----------------------------------------------------------------------
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.395 s -- in edu.self.nyg.example.junit.SimpleIT
XXX 21:35:59.684 [main] INFO  [] 

-------------------------------------------------------------------------------------
   _______. _______ .______       _______ .__   __.  __  .___________.____    ____ 
  /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   / 
 |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /  
  \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/   
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |     
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|    
                                                                                   
News and tutorials at http://www.serenity-bdd.info                                  
Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/             
Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core 
Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport  
-------------------------------------------------------------------------------------

[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- failsafe:3.1.2:verify (default) @ serenity ---
[INFO] 
[INFO] --- install:3.1.0:install (default-install) @ serenity ---
[INFO] Installing /Users/user/Documents/dev/java/example-serenity/pom.xml to /Users/user/.m2/repository/edu/self/nyg/example/serenity/1.0.0-SNAPSHOT/serenity-1.0.0-SNAPSHOT.pom
[INFO] Installing /Users/user/Documents/dev/java/example-serenity/target/serenity-1.0.0-SNAPSHOT.jar to /Users/user/.m2/repository/edu/self/nyg/example/serenity/1.0.0-SNAPSHOT/serenity-1.0.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.109 s
[INFO] Finished at: 2023-07-13T21:36:00+02:00
[INFO] ------------------------------------------------------------------------
[WARNING] 
[WARNING] Plugin validation issues were detected in 1 plugin(s)
[WARNING] 
[WARNING]  * org.apache.maven.plugins:maven-resources-plugin:3.3.0
[WARNING] 
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING] 

By the way, I think #3114 can be closed.

@wakaleo
Copy link
Member

wakaleo commented Jul 17, 2023

It might happen if you are running tests in parallel.

@nyg
Copy link
Author

nyg commented Jul 17, 2023

How can I control if tests are executed in parallel or not? I have tried the following but still have the same output:

$ /usr/local/bin/mvn -v
Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c)
Maven home: /usr/local/Cellar/maven/3.9.2/libexec
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.7", arch: "x86_64", family: "mac"

$ /usr/local/bin/mvn clean install -DforkCount=1 -Dparallel=none
…

@mujamil90
Copy link

I am also getting this issue. My tests are not running in Parallel mode.

@scormaq
Copy link
Contributor

scormaq commented Sep 15, 2023

I use serenity 4.0.5, gradle + junit5
My dependencies are next:

    implementation "ch.qos.logback:logback-classic:$logback_version"
    implementation "ch.qos.logback:logback-core:$logback_version"
    implementation "org.slf4j:slf4j-api:$slf4j_version"
    implementation "org.slf4j:slf4j-jdk14:$slf4j_version"
    implementation "org.slf4j:log4j-over-slf4j:$slf4j_version"

I run tests in single thread, no parallel mode at all. In logs I see that banner is printed 3 times at the beginning, then every Serenity log entry (Test Suite Started, step executed etc) is printed twice. Also banner is printed a couple of times during test run, can't tell why (maybe before each suite).
My own logs are printed only once (as expected), so I'm sure there no issues with log framework misconfiguration on my side.

@nyg
Copy link
Author

nyg commented Sep 25, 2023

Just wanted to confirm I cannot reproduce the issue with version 4.0.12. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants