Skip to main content
1-Visitor
Sep 22, 2014 8:18 PM UTC
Solved

Redirect output from CLI command

Hello,

Has anyone discovered a way to redirect the ouput from the CLI to a log file? I would like to redirect the ID and/or any errors from the command window to a text file that can be viewed at a later time. I have tried "im createissue .... >log.txt" with no results entered in the txt file.

Thank You,

Paul

    mrumpAnswer
    16-Pearl
    Sep 23, 2014 6:17 AM UTC

    Hi Paul,

    the problem is that some of the CLI commands return on STDERR while other messages come through STDOUT.

    So to be shure you get all the output you would see in the shell in your log-file, you'll have to redirect both streams

    e.g.

    "im createissue .... >log.txt 2>&1

    HTH Matthias

    3 replies

    mrump16-PearlAnswer
    16-Pearl
    Sep 23, 2014 6:17 AM UTC

    Hi Paul,

    the problem is that some of the CLI commands return on STDERR while other messages come through STDOUT.

    So to be shure you get all the output you would see in the shell in your log-file, you'll have to redirect both streams

    e.g.

    "im createissue .... >log.txt 2>&1

    HTH Matthias

    Translate
    1-Visitor
    Sep 24, 2014 7:45 PM UTC

    Matthias,

    Thank you for the help. I am now getting an entries in the log file, but it they are comming in like the following:

    牃慥楴杮倠潲牧浡删煥極敲敭瑮⸠⸮ഠ⨊⨪䌠畯摬渠瑯猠癡⁥瑩浥›䭍ㅓ㐲㔲㨰䘠敩.....

    Do you have any ideas why this would be happening?

    Thank You,

    Paul

    Translate
    1-Visitor
    Sep 25, 2014 12:20 PM UTC

    Hi Paul,

    Matthias is right. That's the way to Pipe your cmd output into a file.

    It's described in the www when you search for "technet using command redirection operators".

    I'm not sure what you've done to get this output 🙂

    Translate