fluent / fluent-logger-scala   0.7.0

Website GitHub

A structured logger implementation in Scala.

Scala versions: 2.12 2.11

fluent-logger-scala Build Status Maven Central Scaladoc

Fluentd logger for Scala

Many web/mobile applications generate huge amount of event logs (c,f. login, logout, purchase, follow, etc). To analyze these event logs could be really valuable for improving the service. However, the challenge is collecting these logs easily and reliably.

Fluentd solves that problem by having: easy installation, small footprint, plugins, reliable buffering, log forwarding, etc.

fluent-logger-scala is a Scala library, to record the events from Scala application, based on fluent-logger-java. Main difference between scala and java version is to support Scala Collection.

Please see QuickStart to get started!

Usage

# For Scala 2.11 and 2.12 (Since fluent-logger-scala 0.7.0)
libraryDependencies += "org.fluentd" %% "fluent-logger-scala" % "(version)"

# For Scala 2.10 users (deprecated)
libraryDependencies += "org.fluentd" %% "fluent-logger-scala" % "0.6.0"

API

fluent-logger-scala API is based on fluent-logger-java:

FluentLoggerFactory#getLogger(tag: String): FluentLogger
FluentLoggerFactory#getLogger(tag: String, host: String, port: Int): FluentLogger
FluentLoggerFactory#getLogger(tag: String, host: String, port: Int, timeout: Int, bufferCapacity: Int): FluentLogger
FluentLoggerFactory#flushAll(): Unit
FluentLoggerFactory#closeAll(): Unit

FluentLogger#log(label: String, key: String, value: Any): Boolean
FluentLogger#log(label: String, key: String, value: Any, timestamp: Long): Boolean
FluentLogger#log(tag:String, mutableMap/immutableMap[String, Any]):Boolean
FluentLogger#flush()
FluentLogger#close()

For Developers

$ ./sbt
> compile
> test
# cross Scala version testing
> + test

Publishing to Maven Central

Describe your account information in $HOME/.sbt/(sbt-version)/sonatype.sbt file:

credentials += Credentials("Sonatype Nexus Repository Manager",
    "oss.sonatype.org",
    "(Sonatype user name)",
    "(Sonatype password)")

The release command will publish signed artifacts to the Sonatype repository, and perform releasing to Maven Central:

./sbt release

License and Copyright

  • Copyright © 2011- Tsuyoshi Ozawa and Taro L. Saito
  • Apache License, Version 2.0

Misc

This document is inspired by fluent-logger-python