Last updated at Mon, 30 Oct 2017 13:26:31 GMT

On my personal blog a few months ago, I wrote about integrating Clojure with Logentries. As I mentioned there, if you write code in a language that targets the JVM, you can almost definitely send your log data to Logentries by leveraging our existing Java language support.

Scala has a plethora of idiomatic wrappers for classical Java logging libraries, my favorite of which would be Typesafe’s scalalogging. But to illustrate the Simplest Thing That Could Possibly Work™, let’s look at integrating our log4j appender with a Hello world Scala app.

As long as you have the log4j and logentries-appender dependencies along with a log4j configuration in your classpath (sample POM here), adding a logging facility to existing code is as simple as this:

package com.logentries.scala

import org.apache.log4j.LogManager

object Main {

  def main(args: Array[String]) {
    val log = LogManager.getRootLogger()
    log.debug("Hello, Scala world!")

If you don’t have a working Scala installation but do have Java 6+ and Maven, check out the demo:

$ git clone
$ cd logentries-scala-demo
# ...add your Logentries token in src/main/resources/log4j.xml...
$ mvn scala:run

…then check your log dashboard.

Developers using JVM-hosted languages are confronted by an endless selection of logging frameworks and peripheral libraries, but if you’re using Scala and don’t want to spend hours wading through configuration, it doesn’t get much simpler than this.