sbt-one-log is a sbt plugin make logging dependency easy.
sbt-one-log plugin provides you an easy way to manage the logging dependency (avoid the logging lib hell):
- Resolve the logging dependencies chaos in your development.
- Just make logging work as you expect and follow the best practice, automatically.
- Keep the dependency available when generate
pom.xml.
- π§ Features
- π₯ Usage
- π Release notes
- β¨ Why
sbt-one-log - π©βπ For developers
- π License
- Automatic uniform your logging dependencies, current support
slf4jandlogback, other logging lib will be bridged toslf4j. scala-loggingsupport, if you don't need it, you can turn off thescala-loggingsupport.- Task
generateLogbackXMLto help you generate thelogback.xmlandlogback-test.xml.
For sbt 0.13.5 or above, if you use sbt under 0.13.5, please use : 0.1.3
Add sbt-one-log plugin to the sbt configuration:
addSbtPlugin("com.zavakid.sbt" % "sbt-one-log" % "1.0.1")// oneLogSettings will add libDependencies and resolvers
lazy val yourProject = (project in file(".")).enablePlugins(SbtOneLog)Now sbt-one-log will add the logging dependency and override other logging lib automatically.
important: oneLogSettings must position after libraryDependencies.
import sbt._
import sbt.Keys._
import com.zavakid.sbt._
object Build extends sbt.Build {
// add oneLogSettings to your settings
lazy val root = Project(
id = "example",
base = file(.),
).enablePlugins(SbtOneLog)
//...
//other settings
//...
}
Now everything is OK.
See sbt-one-log release notes.
Scala can leverage lots of perfect Java lib, but it's chaotic with the logging libs in Java world.
Looking at the logging libs below: π
java.util.loggingcommons-loggingcommons-logging-apilog4jslf4jlogbacklog4j 2scala-loggingslf4s(the latest version only supportScala2.9.1)Grizzled SLF4JAVSLlogladylogula(abandoned)
Of course, you can keep your project dependency cleanly with one or two logging lib (e.g., slf4j and logback)
But sometimes your other dependencies is out of control.
e.g., if your dependency with apache httpclient lib which contains dependency with commons-logging, you will log with commons-logging
Also, you can add jcl-over-slf4j and exclude commons-logging explicitly in libraryDependencies setting.
A better way is to explicitly declare dependency commons-logging with the special version 99-empty.
So, sbt-one-log comes to free your hands.
After (fix bugs)/(add features), please add test case and run test. to run test, just
scripts/bump-version.sh 1.x.y
sbt publishLocal
sbt scriptedWhen release a new version, make sure to publish to notes.implicit.ly by herald please.
sbt-one-log is under the Apache 2.0 License.