From 7738002099997282b77dee26884906132d397221 Mon Sep 17 00:00:00 2001 From: Lindsey Dew <1202622+lindseydew@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:45:42 +0100 Subject: [PATCH] Use slf4j logger --- build.sbt | 5 ----- common/src/main/scala/com/gu/sfl/Logging.scala | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 889a2761..fc41eb40 100644 --- a/build.sbt +++ b/build.sbt @@ -56,11 +56,6 @@ val commonSettings: immutable.Seq[Def.Setting[_]] = List( case PathList(ps @ _*) if ps.last equalsIgnoreCase "Log4j2Plugins.dat" => sbtassembly.Log4j2MergeStrategy.plugincache case _ => MergeStrategy.first }, -// dependencyOverrides ++= Seq( -//// commonsLogging, -//// slf4jApi, -// -// ), organization := "com.gu", version := "1.0", scalaVersion := "2.12.19", diff --git a/common/src/main/scala/com/gu/sfl/Logging.scala b/common/src/main/scala/com/gu/sfl/Logging.scala index 98b1654e..18144fcd 100644 --- a/common/src/main/scala/com/gu/sfl/Logging.scala +++ b/common/src/main/scala/com/gu/sfl/Logging.scala @@ -1,11 +1,12 @@ package com.gu.sfl -import org.apache.logging.log4j.LogManager +import org.slf4j.Logger +import org.slf4j.LoggerFactory import scala.util.{Failure, Success, Try} trait Logging { - val logger = LogManager.getLogger(this.getClass.getName) + val logger: Logger = LoggerFactory.getLogger(this.getClass.getName) def logOnThrown[T](function: () => T, messageOnError: String = ""): T = Try(function()) match { case Success(value) => value