Forum Discussion
nmrao
Champion Level 3
If you are looking for date and all you need provide the appropriate value in the configuration for ConversionPattern.
You may try something like below
%d{dd-MMM-yyyy HH:mm:ss,SSS} [%-8t] %-5p %c{1}:%L %x - %m %n
davidp_1
9 years agoOccasional Contributor
The reason I mention it is because if you include the date, and you elect to go with the groovy power assert formatting, it won't look right (those lines won't line up correctly).
Instead of this:
assert expected == actual | | | Some Text| Some Unexpected Text false
You'll get this:
2015-12-01 23:05:26,655 INFO [LOGGER] assert expected == actual | | | Some Text| Some Unexpected Text false
- nmrao9 years agoChampion Level 3May be a small hack, if that is ok, by changing
logger.info(e.getMessage())
to
logger.info('\n'+e.getMessage())- davidp_19 years agoOccasional Contributor
Thanks!
I have a different hack, though. I changed the layout conversion pattern parameters in the log4j appender definition to include the date plus an extra line break (%n parameter), like this:
<layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{dd-MMM-yyyy HH:mm:ss} %n%m%n"/> </layout>
With the results looking like this:
02-Dec-2015 09:26:17 assert expected == actual | | | Some Text| Some Unexpected Text false
- nmrao9 years agoChampion Level 3Got you got over it.