[ 
https://issues.apache.org/jira/browse/TOREE-395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15933729#comment-15933729
 ] 

Kevin Bates edited comment on TOREE-395 at 3/21/17 3:20 PM:
------------------------------------------------------------

Changing the initialization of {{multiOutputStream}} in ScalInterpreter.scala 
from:
{{protected val multiOutputStream = MultiOutputStream(List(Console.out, 
lastResultOut))}}
to
protected val multiOutputStream = MultiOutputStream(List(new 
ConditionalOutputStream(Console.out, logger.isDebugEnabled), lastResultOut))

appears to do the trick.  My concern is that it would require developers to 
enable debug in order to see the output they see today.  However, I also feel 
its best to error on the side of not logging potentially sensitive information 
by default.

If we took this approach, we could add the following lines to log4j.properties 
so that only the scala interpreter could be enabled for debug.

{{# Change the following to DEBUG to see interpreter results in log}}
{{log4j.logger.org.apache.toree.kernel.interpreter.scala=INFO}}


Other options are to add an interpreter argument to indicate that scala 
interpreter results should be produced (or should be silent - depending on what 
the default should be) or remove the code to post to the console altogether 
(and match the other interpreters).


was (Author: kbates):
Changing the initialization of {{multiOutputStream}} in ScalInterpreter.scala 
from:
{{protected val multiOutputStream = MultiOutputStream(List(Console.out, 
lastResultOut))}}
to
protected val multiOutputStream = MultiOutputStream(List(new 
ConditionalOutputStream(Console.out, logger.isDebugEnabled), lastResultOut))

appears to do the trick.  My concern is that it would require developers to 
enable debug in order to see the output they see today.  However, I also feel 
its best to error on the side of not logging potentially sensitive information 
by default.

If we took this approach, we could add the following lines to log4j.properties 
so that only the scala interpreter could be enabled for debug.

{{# Change the following to DEBUG to see interpreter results in log}}
{{log4j.logger.org.apache.toree.kernel.interpreter.scala=INFO}}


Another option is to add an interpreter argument to indicate that scala 
interpreter results should be produced (or should be silent - depending on what 
the default should be).

> Provide a way to disable automatic printing of results in Toree Scala
> ---------------------------------------------------------------------
>
>                 Key: TOREE-395
>                 URL: https://issues.apache.org/jira/browse/TOREE-395
>             Project: TOREE
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Kun Liu
>
> Scala REPL supports a flag, ":silent" to enable/disable automatic printing of 
> results (those messages begin with "res"). This is also supported in Spark 
> shell. But for Toree Scala kernel, this flag is not supported. Thus the 
> result of a cell would be always printed.
> But if there is any logging mechanism, the results would be recorded in a log 
> file, while this may not be desirable. For instance, a user may not want any 
> sensitive data logged when running "dataRDD.take(5)" in a cell.
> Also found the possible source codes for this:
> https://github.com/apache/incubator-toree/blob/master/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
> There are three methods with silent: Boolean = false as parameter.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to