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

use logger in the scala presentation compiler #8717

Closed
scabug opened this issue Jul 11, 2014 · 5 comments
Closed

use logger in the scala presentation compiler #8717

scabug opened this issue Jul 11, 2014 · 5 comments

Comments

@scabug
Copy link

scabug commented Jul 11, 2014

Currently, the Global uses a bunch of boolean settings to decide whether to log messages... but it uses println which is a real pain when used by downstream libraries (e.g. scala-ide and ENSIME). We can't filter any of the messages or re-direct them except with a big on/off button. Also, there are a bunch of messages that just can't be turned off at all and it look really weird to our users when we are trying to capture the stdout for meaningful debugging information.

Please, please, consider using a logger (J2SE has the JUL, which can easily be redirected with SLF4J by downstream users like me) instead of println.... or at the very least take in a Writer for debug/verbose/whatever levels.

@scabug
Copy link
Author

scabug commented Jul 11, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8717?orig=1
Reporter: Samuel Halliday (fommil)

@scabug
Copy link
Author

scabug commented Jul 15, 2014

@adriaanm said:
I agree it would be good to provide more fine-grained control (without sacrificing performance; I also don't think Java logging would be a good fit, though). I'm open to a refactoring that introduces overridable methods for different logging levels. Would you be interested to contribute this?

@scabug
Copy link
Author

scabug commented Jul 15, 2014

Samuel Halliday (fommil) said:
I am not keen on creating yet another logging library. JUL is part of J2SE and I'd be perfectly happy to send you a PR that simply replaces the current println usages in Global with the equivalent JUL debug/fine statements. For downstream users (like me, in ENSIME) we can trivially redirect JUL log messages to SLF4J and manage it there (e.g. with logback).

However, if you don't want to use JUL then at least removing the @inline and allowing these methods to be overridden should be good enough.

BTW I think there is some bug in the way the @inline methods are being interpreted. Even when my debug/verbose boolean vals are false (and I can check this), I still see some debug/verbose statements coming through on the terminal. It is just really really weird.

@scabug
Copy link
Author

scabug commented Oct 19, 2016

@dragos said:
I agree this is a pain, and a Java logging framework is the simplest way forward. For example, Code is using stdio as a transport protocol for its language server and any unwanted output is going to break it down completely.

@adriaanm, can you elaborate why Java logging isn't an option?

If we go for overridable methods we still need to make them "not inline", which may or may not hurt performance. I don't know what the current optimizer can do, but at some point in the past, @inline log saved about 8% in code size and a couple of percentages in speed. It may not be an issue in 2.12 and Java 8 lambdas, but I think any fix should be backported to 2.11 too.

@SethTisue
Copy link
Member

Scala IDE is dead and the old ENSIME is too, so I'm guessing there's probably no longer downstream appetite for this?

@SethTisue SethTisue closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants