5

How could I get the log statements which are written in the spring application while running the cucumber test?

I am getting the logs written in the step definitions, but I am not getting the logs from actual code.

Thanks in advance.

Eldhose
  • 163
  • 2
  • 4
  • Simple trick: log into a log file. Completely opinion based, but for long tests who involves tons of logs, wrapping it in a file is probably easyer to read in the end anyway. – N.K Apr 12 '18 at 09:09
  • What if I need to get it appended to console... I mean what changes should I make in log4j.xml – Eldhose Apr 12 '18 at 09:41
  • What I need is something like, while running cukes, we are building a jar and running the service locally and hitting it. So I need to get the log statements written within the service to be appended to the console along with the logs written in step definitions. – Eldhose Apr 12 '18 at 09:45
  • In this case i don't really know, in fact we definitely lack informations like examples of your code etc, that's why i commented (appart from the fact that "put that in a log file" is not an answer at all). – N.K Apr 12 '18 at 11:12
  • For consideration: do you really need the log statements? Are you testing your application or the logging framework? – Marit Apr 14 '18 at 05:01
  • I am testing the webservices which I wrote and I need logs to be appended along with the logs of cucumber in console. I can use a file appender to append to a file. In short, can I use two console appenders in log4j at a time to write the logs from different packages? – Eldhose Apr 19 '18 at 11:57

0 Answers0