Skip to main content
1-Visitor
September 22, 2014
Solved

Redirect output from CLI command

  • September 22, 2014
  • 1 reply
  • 1623 views

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

    Best answer by mrump

    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

    1 reply

    mrump16-PearlAnswer
    16-Pearl
    September 23, 2014

    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

    1-Visitor
    September 24, 2014

    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

    1-Visitor
    September 25, 2014

    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 🙂