Forum Discussion
nmrao
10 years agoCommunity Hero
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 %ndavidp_1
10 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
falseYou'll get this:
2015-12-01 23:05:26,655 INFO [LOGGER] assert expected == actual
| | |
Some Text| Some Unexpected Text
false
- nmrao10 years agoCommunity HeroMay be a small hack, if that is ok, by changing
logger.info(e.getMessage())
to
logger.info('\n'+e.getMessage())- davidp_110 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- nmrao10 years agoCommunity HeroGot you got over it.