I am using IntelliJ and Java. I want to copy the output of the running program to a string. This solution must work both locally in IntelliJ and in a Jenkins job.
For example, my running console output looks like this:
log4j:ERROR Could not find value for key log4j.appender.stdot
log4j:ERROR Could not instantiate appender named "stdot". log4j:ERROR
Could not find value for key log4j.appender.stdout log4j:ERROR Could
not instantiate appender named "stdout". [1;34m2019-05-12 08:17:38
Property file env/application.properties parsed successfully[0m
I want to copy all of this log to a string. I've tried numerous solutions but none of them have worked.