How to control console output log level from mvn verify command

1,600 views
Skip to first unread message

80Vikram

unread,
Sep 9, 2015, 6:14:11 AM9/9/15
to Serenity BDD Users Group
Hi All,

I run test cases with mvn verify command and it shows tons of logs with INFO , WARN etc.

But I just need INFO , is there way to control depth of logs shown on console ?

Thanks in advance.

Regards,
Vikram

MK

unread,
Sep 9, 2015, 4:35:38 PM9/9/15
to Serenity BDD Users Group
You can set

serenity.logging to QUIET, NORMAL and VERBOSE in serenity.properties file.

80Vikram

unread,
Sep 10, 2015, 1:22:58 PM9/10/15
to Serenity BDD Users Group
Hi MK,

Thanks for reply but none of these have affect on mvn verify console output. For each one I see WARN , INFO etc

Any other hacks ?

Regards,
Vikram

Dmitriy Grablyov

unread,
Sep 11, 2015, 4:16:25 AM9/11/15
to Serenity BDD Users Group
Hi, 80Vikram .
WARN log level has basically higher priority than INFO, so you cannot just switch it off without switching off INFO level.

to control log level over your project change logger binding. E.g. try log4j
in your pom specify dependencies:
<dependency>
 
<groupId>org.slf4j</groupId>
 
<artifactId>slf4j-log4j12</artifactId>
 
<version>1.7.12</version>
 
</dependency>
 
<dependency>
 
<groupId>org.slf4j</groupId>
 
<artifactId>slf4j-api</artifactId>
 
<version>1.7.7</version>
 
</dependency>

In this case you'll also be able to use slf4j logger.
Than add log4j.properties file to src/main/resources directory of your project.

its contents should be as:
# Root logger option
log4j.rootLogger=INFO, stdout
 
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{MMM-dd HH:mm:ss.SSS} [%t] %-5p %c{1} - %m%n

where you can change INFO to WARN or DEBUG.

But again, if you setup INFO, you'll be seeing messages like INFO, WARN, ERROR, FATAL
if you set WARN, you'll be seeing WARN, ERROR, FATAL
and there is no known for me option to see infos without warns
Reply all
Reply to author
Forward
0 new messages