Thanks to visit codestin.com
Credit goes to github.com

Skip to content

log.error and error does not print to sderr #5942

Description

@maxulysse

New feature

I would love an easy way to print to stderr.
log.error print to stdout, but prints in red with the ERROR keyword before.
I understand that it's for logging purpose first, but I would love for an easy way print to stderr in Nextflow .
While we're at it, if we could use the same method to print similar messages in the plugins that would be perfection.
If I look at this for example: https://github.com/nextflow-io/nf-schema/blob/ecf159f53d45200ef70920c03e75077b5689a386/plugins/nf-schema/src/main/nextflow/validation/ValidationExtension.groovy#L319-L323
the log.error is printed to stdout while the other message is indeed printed to both stdout and stderr.

Use case

I would want to be able to print my error message from the pipeline side, error and exit right away without catching other unrelated errors.

Suggested implementation

I think the error method should the right way to do it, if it was printing to stderr.
Still I did notice some unrelated messages that appears and throws some red herrings that confuses users (and me too)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions