zeroturnaround / zt-exec

ZeroTurnaround Process Executor
Apache License 2.0
883 stars 110 forks source link

zt-exec converting multi-line output to single line #59

Open muhammad-asad-confiz opened 6 years ago

muhammad-asad-confiz commented 6 years ago

Hi,

I am facing a problem that is my output, which is being redirected to logger is quite large and it's multi-line but zt-exec converts that multi-line to a single line. Due to this reason my business logic is failing. Is there a way in zt-exec to maintain the new lines and carriage returns.

toomasr commented 6 years ago

Do you mind providing an example for this?

toomasr commented 6 years ago

I deleted your comment as it might have had some personal information that you might not have wanted to share. As for an example I meant code not the output. Some code the reproduces the issue you are seeing.

1DanielC commented 3 years ago

I'm experiencing this same issue. My stderr from a python script i'm running looks like:

Traceback (most recent call last):
  File "somethingSomething"
AssertionError

and, when running :

ProcessExecutor()
      .command(cmd)
      .readOutput(true)
      .redirectError(Slf4jStream.of(LOG).asError())
      .execute()

it is translated to

2021-08-11 19:01:58.336 ERROR [      Thread-19] o.package.CommandRunner: Traceback (most recent call last):
2021-08-11 19:01:58.337 ERROR [      Thread-19] o.package.CommandRunner:     File "somethingSomething"
2021-08-11 19:01:58.338 ERROR [      Thread-19] o.package.CommandRunner: AssertionError

Ideally, the errorStream would be able to output this entire trace as one log message, which seems to be very difficult to do with how it's currently designed. It parses carriage returns and newlines before adding it to the logger, which isnt ideal.