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

Please fix logging color on windows console #943

Closed
afshin opened this issue Aug 11, 2022 · 2 comments · Fixed by #1397
Closed

Please fix logging color on windows console #943

afshin opened this issue Aug 11, 2022 · 2 comments · Fixed by #1397

Comments

@afshin
Copy link
Contributor

afshin commented Aug 11, 2022

@char101 opened an issue on JupyterLab that seems like it is likely to be addressable in jupyter_server. What do you think?

Description

It seems that jupyter uses tornado.log for logging. In the comment of tornado.log it is written

Color support on Windows versions that do not support ANSI color codes is
enabled by use of the colorama__ library. Applications that wish to use
this must first initialize colorama with a call to ``colorama.init``.
See the colorama documentation for details.

Unfortunately colorama.init() is never called by jupyter causing logging ANSI color to be output as raw escape codes.

Reproduce

  1. Run jupyter lab
  2. Log shows raw ANSI escape sequences for color ←[2;32m[I 2022-08-07 18:50:14.236 ServerApp]←[0m

Expected behavior

Colored log in windows console.

Context

  • Operating System and version: Windows 10
  • Browser and version: N/A
  • JupyterLab version: 3.4.4

Resolution

If possible please add colorama.init() in the main code

try:
    import colorama
    colorama.init()
except ImportError:
    pass

cf. jupyterlab/jupyterlab#12917

@kevin-bates
Copy link
Member

@afshin - thank you for forwarding the issue here. This makes sense.

@char101 - great write-up! Is this a change you'd like to contribute? I think the suggested change would simply go into the imports area of serverapp.py. if this is something you'd rather defer to someone else, that's fine too.

@char101
Copy link

char101 commented Aug 12, 2022

Since this is only a small change I would prefer to defer to someone else, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants