Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Human-readable (non-ANSI) console output logs #1825

Closed
egabrum opened this issue Feb 12, 2019 · 13 comments
Closed

Human-readable (non-ANSI) console output logs #1825

egabrum opened this issue Feb 12, 2019 · 13 comments
Labels
Projects
Milestone

Comments

@egabrum
Copy link

@egabrum egabrum commented Feb 12, 2019

Versions

ConEmu build: 180626 x64
OS version: Windows 10 x64
Used shell version: cmd and powershell

Problem description

The console output log contains multiple codes that make it unreadable.
Would it be possible to log a stripped-out version of the log?

Steps to reproduce

  1. Enable console output logging.
  2. Open a terminal. Enter a few commands.
  3. Open the log file.

Actual results

�]9;11;"cmd.exe: SetConsoleTextAttribute(0x07)"�\myMachine�]9;11;"hostname.exe: SetConsoleCursorPosition(0,1)"�\
ConEmuAnsiLog: C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs\ConEmu-2019-02-12-p38816.log

�[1;32;40m190212-122629 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs  
�]9;11;"cmd.exe: ExtSetAttributes(0x0A)"�\�[1;30;40mλ �[0m�]9;11;"cmd.exe: ExtSetAttributes(0x08)"�\�]9;11;"cmd.exe: ExtSetAttributes(0x07)"�\�]9;11;"cmd.exe: SetConsoleCursorPosition(2,5)"�\l�]9;11;"cmd.exe: SetConsoleCursorPosition(3,5)"�\s�]9;11;"cmd.exe: SetConsoleCursorPosition(4,5)"�\
�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x09)"�\2017�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\/                          �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-25-p11056.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p11140.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p21952.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,7)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x09)"�\2018�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\/                          �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-25-p17772.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p12724.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p29504.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,8)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x09)"�\2019�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\/                          �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-26-p18572.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p15304.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-06-p4768.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,9)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-23-p15740.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-28-p15576.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p17236.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-09-p4828.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,10)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-23-p17680.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-28-p25652.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-31-p3952.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-11-p31832.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,11)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-23-p8052.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-29-p25416.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-01-p14016.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-12-p25292.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,12)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-24-p17872.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-29-p7040.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-04-p18584.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-12-p35164.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,13)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-24-p26092.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-29-p7996.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*   �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p13796.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-12-p38816.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,14)"�\�]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-24-p31952.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-01-30-p20112.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*  �]9;11;"ls.exe: SetConsoleTextAttribute(0x0A)"�\ConEmu-2019-02-05-p18628.log�]9;11;"ls.exe: SetConsoleTextAttribute(0x07)"�\*�]9;11;"ls.exe: SetConsoleCursorPosition(0,15)"�\

�[1;32;40m190212-122638 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs  
�]9;11;"cmd.exe: ExtSetAttributes(0x0A)"�\�[1;30;40mλ �[0m�]9;11;"cmd.exe: ExtSetAttributes(0x08)"�\�]9;11;"cmd.exe: ExtSetAttributes(0x07)"�\�]9;11;"cmd.exe: SetConsoleCursorPosition(2,17)"�\

Expected results

myMachine
ConEmuAnsiLog: C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs\ConEmu-2019-02-12-p38816.log

190212-122629 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs
λ ls
2017/                          ConEmu-2019-01-25-p11056.log*  ConEmu-2019-01-31-p11140.log*  ConEmu-2019-02-05-p21952.log*
2018/                          ConEmu-2019-01-25-p17772.log*  ConEmu-2019-01-31-p12724.log*  ConEmu-2019-02-05-p29504.log*
2019/                          ConEmu-2019-01-26-p18572.log*  ConEmu-2019-01-31-p15304.log*  ConEmu-2019-02-06-p4768.log*
ConEmu-2019-01-23-p15740.log*  ConEmu-2019-01-28-p15576.log*  ConEmu-2019-01-31-p17236.log*  ConEmu-2019-02-09-p4828.log*
ConEmu-2019-01-23-p17680.log*  ConEmu-2019-01-28-p25652.log*  ConEmu-2019-01-31-p3952.log*   ConEmu-2019-02-11-p31832.log*
ConEmu-2019-01-23-p8052.log*   ConEmu-2019-01-29-p25416.log*  ConEmu-2019-02-01-p14016.log*  ConEmu-2019-02-12-p25292.log*
ConEmu-2019-01-24-p17872.log*  ConEmu-2019-01-29-p7040.log*   ConEmu-2019-02-04-p18584.log*  ConEmu-2019-02-12-p35164.log*
ConEmu-2019-01-24-p26092.log*  ConEmu-2019-01-29-p7996.log*   ConEmu-2019-02-05-p13796.log*  ConEmu-2019-02-12-p38816.log*
ConEmu-2019-01-24-p31952.log*  ConEmu-2019-01-30-p20112.log*  ConEmu-2019-02-05-p18628.log*

190212-122638 C:\Users\User\Box Sync\mySEsync\myPortable\cmdermini\vendor\conemu-maximus5\Logs
λ
@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Feb 12, 2019

Logs were intended to store data from console, generally for reporting purposes. Without codes they would have much less value.

If you want to read them, you may just "print" them to console, e.g. "type ConEmu-...log".

Loading

@egabrum
Copy link
Author

@egabrum egabrum commented Feb 12, 2019

Thanks for the workaround. I'd rather be able to just search/open the logs without post-processing. I'd suggest a switch to select the format of the log. The current format must be very useful for some use cases, but I suspect (just a guess) that the majority of users would default to a plain log format.
But I'll understand if this is not a priority for you.

P.S. Do you know of any editor/viewer that interprets the current log format (presenting it in the same manner it was printed to screen)?

Loading

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Feb 13, 2019

Loading

@egabrum
Copy link
Author

@egabrum egabrum commented Feb 14, 2019

Looks like \x1b[^\x1b]+\x1b\\ does the trick.
I haven't lost hope though... ;-)
#1697

Loading

@egabrum
Copy link
Author

@egabrum egabrum commented Feb 17, 2019

So I've gone back to some older logs (I work with logs often, hence my being reluctant to having to post-process them) and found that they used to be pretty readable. They only became not human-readable after this change:
https://conemu.github.io/blog/2018/03/09/Build-180309.html

Write to ANSI Log calls to certain console WinAPI functions. Example: ^[]9;11;"cmd.exe: SetConsoleCursorPosition(0,0)"^[.

Wouldn't it be fair to make this new feature optional for those that were pretty happy with the logging as it was?

Loading

@Maximus5 Maximus5 added this to the 190311 milestone Mar 10, 2019
@Maximus5 Maximus5 added this to To Do in ConEmu via automation Mar 10, 2019
@Maximus5 Maximus5 moved this from To Do to Ready for Testing in ConEmu Mar 24, 2019
@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Mar 25, 2019

190324?

Loading

@egabrum
Copy link
Author

@egabrum egabrum commented Mar 25, 2019

Seems to work like a charm on 190324
Thanks!

Loading

@Maximus5 Maximus5 closed this Mar 25, 2019
ConEmu automation moved this from Ready for Testing to Done Mar 25, 2019
@TT--
Copy link

@TT-- TT-- commented Jul 9, 2019

I wasn't able to see this working on Windows 10 with version 190324, latest preview of 190526 or latest 190623.

Besides things like the <0x1b> (aka ) I also see some stuff like [33m and [m ... Should the regex of \x1b[^\x1b]+\x1b\\ be sufficient to remove those with sed ?

Loading

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 9, 2019

@TT-- What exactly don't you see working, what do you have (screenshot) and what do you expect?

Loading

@mickeyedge
Copy link

@mickeyedge mickeyedge commented Jan 29, 2020

I'm having the same issue. The attached log file has a powershell session with an ssh to a centos host. The ssh is human readable while the powershell cmds are not
ConEmu-2020-01-29-p16260.log

Loading

@TT--
Copy link

@TT-- TT-- commented Jan 29, 2020

Yes, something like this example is what I am referring to.

Loading

@mickeyedge
Copy link

@mickeyedge mickeyedge commented Jan 29, 2020

I'm seeing the same behavior using WSL.
ConEmu-2020-01-29-p16932.log

Is there any additional information you need from my local system?

Loading

@ethirolle
Copy link

@ethirolle ethirolle commented Jul 10, 2020

I am also seeing same issue when using WSL, on ConEmu 191012 [64]. The issue is particularly acute when you use arrow keys and backspaces to edit a command from the command history.

Here is a snippet from an example log file:

�]0;ethirolle@LT-THIROLLE: ~/g-net��[01;32methirolle@LT-THIROLLE�[00m:�[01;34m~/g-net�[00m$ ls��./gcom /orgs/simoncteam�����������������������pwd�[K���./gcom /orgs/simoncteam�����������������������pwd�[K���./gcom /orgs/simoncteam�����������������������ls�[K���[K�ls��./gcom /orgs/simoncteam��[K��[K��[K��[K��[K��[K��[K��[K��[K��[Kseric��[K��[K��[K��[K��[Kerict

If I use type logname command on this log file, this all cleans up nicely to:

ethirolle@LT-THIROLLE:~/g-net$ ./gcom /orgs/erict

I am much more interested in having the latter, cleaned-up version of this in the log. For my purposes, the exact keypresses are not useful for logging, and make the logs very hard to read.

Thanks!

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
ConEmu
  
Done
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants