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
.
- Automatic uniform your logging dependencies, current support
slf4j
andlogback
, other logging lib will be bridged toslf4j
. scala-logging
support, if you don't need it, you can turn off thescala-logging
support.- Task
generateLogbackXML
to help you generate thelogback.xml
andlogback-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.logging
commons-logging
commons-logging-api
log4j
slf4j
logback
log4j 2
scala-logging
slf4s
(the latest version only supportScala
2.9.1)Grizzled SLF4J
AVSL
loglady
logula
(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 scripted
When 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.