Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've just been through the whole "getting punished by IDEA" thing and I have this solution for you...</p> <p>Add <a href="http://logback.qos.ch/manual/introduction.html" rel="nofollow">Logback</a> and <a href="https://github.com/weiglewilczek/slf4s" rel="nofollow">slf4s</a> to your POM:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;com.weiglewilczek.slf4s&lt;/groupId&gt; &lt;artifactId&gt;slf4s_${scala.version}&lt;/artifactId&gt; &lt;version&gt;1.0.7&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt; &lt;artifactId&gt;logback-core&lt;/artifactId&gt; &lt;version&gt;0.9.30&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt; &lt;artifactId&gt;logback-classic&lt;/artifactId&gt; &lt;version&gt;0.9.30&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>NOTES:<br/> I've used ${scala.version} in the slf4s artifactId - make sure you have this defined or replace it with 2.9.1 or something like that.<br/> Also - you'll need the scala-tools repo available for dependencies too - which I'm assuming you'll have as I think you need it to compile.</p> <p>Then add a file called logback.xml to your resources folder containing this:</p> <pre><code>&lt;configuration&gt; &lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt; &lt;encoder&gt; &lt;pattern&gt;%date,%d{HH:mm:ss.SSS},%thread,%-5level,%logger{36},%line,%msg%n&lt;/pattern&gt; &lt;/encoder&gt; &lt;/appender&gt; &lt;root level="TRACE"&gt; &lt;appender-ref ref="STDOUT"/&gt; &lt;/root&gt; &lt;/configuration&gt; </code></pre> <p><em>My pattern there is potentially a bit weird - it's actually from a file appender that spits it out as a CSV I can open and graph in Excel easily.</em></p> <p>Then extend the trait Logging in your app like so:</p> <pre><code>import swing._ import com.weiglewilczek.slf4s.Logging object App extends SwingApplication with Logging { override def startup(args: Array[String]) { logger.info("Starting init...") } } </code></pre> <p>And the info message, "Starting init..." with a bunch of other stuff should appear in the console window.</p> <p>Logback and slf4s are topics that I've linked to.</p> <p>IMPORTANT AND AWESOME:</p> <p>I can't remember what it's called but the logging methods you use to post messages all have signatures like info(message: => String) - as you can see in <a href="https://github.com/weiglewilczek/slf4s/blob/master/src/main/scala/logger.scala" rel="nofollow">logger.scala</a>.</p> <p>This means the expression or block you pass to them will not get executed <em>at all</em> if the relevant level of logging isn't enabled in the config file.</p> <p>So it only adds a method call and a flag-check to the code when it's turned off - which is pretty sweet imho :)</p> <p>Hope that helps, Seth.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload