diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/DirectoriesInitialization.scala b/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/DirectoriesInitialization.scala index cb4d1d80b5..14e11eec7b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/DirectoriesInitialization.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/DirectoriesInitialization.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.boot.resource +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.DirectoriesConfig -import org.slf4j.LoggerFactory import scala.concurrent.{ExecutionContext, Future} @@ -11,15 +11,14 @@ import scala.concurrent.{ExecutionContext, Future} */ class DirectoriesInitialization(directoriesConfig: DirectoriesConfig)(implicit ec: ExecutionContext -) extends InitializationComponent { - - private val log = LoggerFactory.getLogger(this.getClass) +) extends InitializationComponent + with LazyLogging { /** @inheritdoc */ override def init(): Future[InitializationComponent.Initialized.type] = Future { directoriesConfig.createDirectories() - log.info("Initialized directories.") + logger.info("Initialized directories.") InitializationComponent.Initialized } } diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/RepoInitialization.scala b/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/RepoInitialization.scala index 210cc1f0c4..d9da2b2314 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/RepoInitialization.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/RepoInitialization.scala @@ -4,12 +4,12 @@ import java.io.IOException import java.nio.file.{FileSystemException, Files, NoSuchFileException} import akka.event.EventStream +import com.typesafe.scalalogging.LazyLogging import org.apache.commons.io.FileUtils import org.enso.languageserver.data.DirectoriesConfig import org.enso.languageserver.event.InitializedEvent import org.enso.logger.masking.MaskedPath import org.enso.searcher.sql.{SqlDatabase, SqlSuggestionsRepo, SqlVersionsRepo} -import org.slf4j.LoggerFactory import scala.concurrent.{ExecutionContext, Future} import scala.util.control.NonFatal @@ -28,9 +28,8 @@ class RepoInitialization( suggestionsRepo: SqlSuggestionsRepo, versionsRepo: SqlVersionsRepo )(implicit ec: ExecutionContext) - extends InitializationComponent { - - private val log = LoggerFactory.getLogger(this.getClass) + extends InitializationComponent + with LazyLogging { /** @inheritdoc */ override def init(): Future[InitializationComponent.Initialized.type] = @@ -43,7 +42,7 @@ class RepoInitialization( val initAction = for { _ <- Future { - log.info( + logger.info( "Initializing suggestions repo [{}].", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath) ) @@ -52,7 +51,7 @@ class RepoInitialization( recoverInitError(error, suggestionsRepo.db) } _ <- Future { - log.info( + logger.info( "Initialized Suggestions repo [{}].", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath) ) @@ -62,7 +61,7 @@ class RepoInitialization( case Success(()) => eventStream.publish(InitializedEvent.SuggestionsRepoInitialized) case Failure(ex) => - log.error( + logger.error( "Failed to initialize SQL suggestions repo [{}]. {}", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath), ex.getMessage @@ -75,14 +74,14 @@ class RepoInitialization( val initAction = for { _ <- Future { - log.info( + logger.info( "Initializing versions repo [{}].", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath) ) } _ <- versionsRepo.init _ <- Future { - log.info( + logger.info( "Initialized Versions repo [{}].", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath) ) @@ -92,7 +91,7 @@ class RepoInitialization( case Success(()) => eventStream.publish(InitializedEvent.FileVersionsRepoInitialized) case Failure(ex) => - log.error( + logger.error( "Failed to initialize SQL versions repo [{}]. {}", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath), ex.getMessage @@ -107,7 +106,7 @@ class RepoInitialization( ): Future[Unit] = for { _ <- Future { - log.warn( + logger.warn( "Failed to initialize the suggestions database [{}]. {}", MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath), error.getMessage @@ -117,18 +116,18 @@ class RepoInitialization( _ <- clearDatabaseFile() _ <- Future(db.open()) _ <- Future { - log.info("Retrying database initialization.") + logger.info("Retrying database initialization.") } _ <- suggestionsRepo.init } yield () private def clearDatabaseFile(retries: Int = 0): Future[Unit] = { Future { - log.info("Clear database file. Attempt #{}.", retries + 1) + logger.info("Clear database file. Attempt #{}.", retries + 1) Files.delete(directoriesConfig.suggestionsDatabaseFile.toPath) }.recoverWith { case _: NoSuchFileException => - log.warn( + logger.warn( "Failed to delete the database file. Attempt #{}. " + "File does not exist [{}].", retries + 1, @@ -136,7 +135,7 @@ class RepoInitialization( ) Future.successful(()) case error: FileSystemException => - log.error( + logger.error( s"Failed to delete the database file. Attempt #${retries + 1}." + s"The file will be removed during the shutdown. ${error.getMessage}." ) @@ -145,7 +144,7 @@ class RepoInitialization( ) Future.failed(error) case error: IOException => - log.error( + logger.error( "Failed to delete the database file. Attempt #{}. {}", retries + 1, error.getMessage diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/TruffleContextInitialization.scala b/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/TruffleContextInitialization.scala index 479cc02e59..7066537e13 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/TruffleContextInitialization.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/boot/resource/TruffleContextInitialization.scala @@ -1,10 +1,10 @@ package org.enso.languageserver.boot.resource import akka.event.EventStream +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.event.InitializedEvent import org.enso.polyglot.LanguageInfo import org.graalvm.polyglot.Context -import org.slf4j.LoggerFactory import scala.concurrent.{ExecutionContext, Future} @@ -18,16 +18,15 @@ class TruffleContextInitialization( truffleContext: Context )(implicit ec: ExecutionContext -) extends InitializationComponent { - - private val log = LoggerFactory.getLogger(this.getClass) +) extends InitializationComponent + with LazyLogging { /** @inheritdoc */ override def init(): Future[InitializationComponent.Initialized.type] = Future { truffleContext.initialize(LanguageInfo.ID) eventStream.publish(InitializedEvent.TruffleContextInitialized) - log.info("Initialized Runtime context.") + logger.info("Initialized Runtime context.") InitializationComponent.Initialized } } diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/capability/CapabilityRouter.scala b/engine/language-server/src/main/scala/org/enso/languageserver/capability/CapabilityRouter.scala index e4dfa255a7..41abae3843 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/capability/CapabilityRouter.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/capability/CapabilityRouter.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.capability -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.capability.CapabilityProtocol.{ AcquireCapability, ReleaseCapability @@ -28,7 +29,7 @@ class CapabilityRouter( receivesTreeUpdatesHandler: ActorRef, suggestionsHandler: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/FileManager.scala b/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/FileManager.scala index 95ea5e6bf1..67f614f69c 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/FileManager.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/FileManager.scala @@ -1,8 +1,9 @@ package org.enso.languageserver.filemanager -import akka.actor.{Actor, ActorLogging, Props} +import akka.actor.{Actor, Props} import akka.routing.SmallestMailboxPool import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.effect._ import org.enso.languageserver.data.Config import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} @@ -21,7 +22,7 @@ class FileManager( fs: FileSystemApi[BlockingIO], exec: Exec[BlockingIO] ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/PathWatcher.scala b/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/PathWatcher.scala index 058b26b972..1a7f7e657c 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/PathWatcher.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/PathWatcher.scala @@ -2,9 +2,10 @@ package org.enso.languageserver.filemanager import java.io.File -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} import akka.pattern.pipe import cats.implicits._ +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.capability.CapabilityProtocol.{ CapabilityAcquired, CapabilityAcquisitionFileSystemFailure, @@ -35,7 +36,7 @@ final class PathWatcher( fs: FileSystemApi[BlockingIO], exec: Exec[BlockingIO] ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher, PathWatcherProtocol._ @@ -57,7 +58,7 @@ final class PathWatcher( private def uninitializedStage: Receive = { case WatchPath(path, clients) => val pathToWatchResult = config .findContentRoot(path.rootId) - .map(path.toFile(_)) + .map(path.toFile) val result: BlockingIO[FileSystemFailure, Unit] = for { pathToWatch <- IO.fromEither(pathToWatchResult) @@ -108,14 +109,14 @@ final class PathWatcher( stopWatcher() restartCounter.inc() if (restartCounter.canRestart) { - log.error(s"Restart on error#${restartCounter.count}", e) + logger.error(s"Restart on error#${restartCounter.count}", e) context.system.scheduler.scheduleOnce( config.pathWatcher.restartTimeout, self, WatchPath(base, clients) ) } else { - log.error("Hit maximum number of restarts", e) + logger.error("Hit maximum number of restarts", e) clients.foreach { client => client ! CapabilityForceReleased( CapabilityRegistration(ReceivesTreeUpdates(base)) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/ReceivesTreeUpdatesHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/ReceivesTreeUpdatesHandler.scala index 9bb82c4fbc..e242671303 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/ReceivesTreeUpdatesHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/filemanager/ReceivesTreeUpdatesHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.filemanager -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Terminated} +import akka.actor.{Actor, ActorRef, Props, Terminated} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.capability.CapabilityProtocol.{ AcquireCapability, CapabilityNotAcquiredResponse, @@ -54,7 +55,7 @@ final class ReceivesTreeUpdatesHandler( fs: FileSystemApi[BlockingIO], exec: Exec[BlockingIO] ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ReceivesTreeUpdatesHandler._ diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/io/InputRedirectionController.scala b/engine/language-server/src/main/scala/org/enso/languageserver/io/InputRedirectionController.scala index 117446314d..5731f7f4ad 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/io/InputRedirectionController.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/io/InputRedirectionController.scala @@ -2,8 +2,9 @@ package org.enso.languageserver.io import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} import akka.util.ByteString +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.ClientId import org.enso.languageserver.event.{ ExecutionContextCreated, @@ -35,7 +36,7 @@ class InputRedirectionController( stdInSink: ObservableOutputStream, sessionRouter: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging with InputObserver { @@ -48,7 +49,7 @@ class InputRedirectionController( private def running(liveContexts: Set[ContextData] = Set.empty): Receive = { case FeedStandardInput(input, isLineTerminated) => - log.debug("Feeding stdin [{} bytes]", input.length) + logger.debug("Feeding stdin [{} bytes]", input.length) if (isLineTerminated) { val bytes = ByteString.createBuilder @@ -68,7 +69,7 @@ class InputRedirectionController( context.become(running(liveContexts - ContextData(contextId, owner))) case ReadBlocked => - log.debug("Blocked read detected.") + logger.debug("Blocked read detected.") liveContexts foreach { case ContextData(_, owner) => sessionRouter ! DeliverToJsonController( owner, diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/io/OutputRedirectionController.scala b/engine/language-server/src/main/scala/org/enso/languageserver/io/OutputRedirectionController.scala index d14c005262..70873ff4f3 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/io/OutputRedirectionController.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/io/OutputRedirectionController.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.io -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.ClientId import org.enso.languageserver.event.JsonSessionTerminated import org.enso.languageserver.io.InputOutputProtocol.{ @@ -26,7 +27,7 @@ class OutputRedirectionController( outputKind: OutputKind, sessionRouter: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging with OutputObserver { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/monitoring/ReadinessMonitor.scala b/engine/language-server/src/main/scala/org/enso/languageserver/monitoring/ReadinessMonitor.scala index 142237ec6c..84c7e42232 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/monitoring/ReadinessMonitor.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/monitoring/ReadinessMonitor.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.monitoring -import akka.actor.{Actor, ActorLogging, Props} +import akka.actor.{Actor, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.event.InitializedEvent.{ InitializationFailed, InitializationFinished @@ -8,7 +9,7 @@ import org.enso.languageserver.event.InitializedEvent.{ import org.enso.languageserver.monitoring.MonitoringProtocol.{IsReady, KO, OK} /** An actor that monitors if the system is ready to accept requests. */ -class ReadinessMonitor() extends Actor with ActorLogging { +class ReadinessMonitor() extends Actor with LazyLogging { override def preStart(): Unit = { context.system.eventStream @@ -28,7 +29,7 @@ class ReadinessMonitor() extends Actor with ActorLogging { context.become(ready()) case InitializationFailed => - log.error("Initialization failed. Terminating JVM...") + logger.error("Initialization failed. Terminating JVM...") System.exit(1) } diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/binary/BinaryConnectionController.scala b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/binary/BinaryConnectionController.scala index 51d93313a1..f7832b15c0 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/binary/BinaryConnectionController.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/binary/BinaryConnectionController.scala @@ -3,9 +3,10 @@ package org.enso.languageserver.protocol.binary import java.nio.ByteBuffer import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash} +import akka.actor.{Actor, ActorRef, Props, Stash} import akka.http.scaladsl.model.RemoteAddress import com.google.flatbuffers.FlatBufferBuilder +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.event.{ BinarySessionInitialized, BinarySessionTerminated @@ -56,7 +57,7 @@ class BinaryConnectionController( requestTimeout: FiniteDuration = 10.seconds ) extends Actor with Stash - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = @@ -87,7 +88,7 @@ class BinaryConnectionController( outboundChannel ! responsePacket val session = BinarySession(clientId, self) context.system.eventStream.publish(BinarySessionInitialized(session)) - log.info( + logger.info( "Data session initialized for client: {} [{}].", clientId, clientIp @@ -114,7 +115,7 @@ class BinaryConnectionController( val handler = context.actorOf(handlers(msg.payloadType())) handler.forward(msg) } else { - log.error( + logger.error( "Received InboundMessage with unknown payload type [{}].", msg.payloadType() ) @@ -129,17 +130,17 @@ class BinaryConnectionController( maybeDataSession: Option[BinarySession] = None ): Receive = { case ConnectionClosed => - log.info("Connection closed [{}].", clientIp) + logger.info("Connection closed [{}].", clientIp) maybeDataSession.foreach(session => context.system.eventStream.publish(BinarySessionTerminated(session)) ) context.stop(self) case ConnectionFailed(th) => - log.error( - th, - "An error occurred during processing web socket connection [{}].", - clientIp + logger.error( + "An error occurred during processing web socket connection [{}]. {}", + clientIp, + th.getMessage ) maybeDataSession.foreach(session => context.system.eventStream.publish(BinarySessionTerminated(session)) @@ -160,7 +161,7 @@ class BinaryConnectionController( case EmptyPayload => ErrorFactory.createReceivedEmptyPayloadError() case DataCorrupted => ErrorFactory.createReceivedCorruptedDataError() case GenericDecodingFailure(th) => - log.error(th, "Unrecognized error occurred in binary protocol.") + logger.error("Unrecognized error occurred in binary protocol.", th) ErrorFactory.createServiceError() } diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala index 50d10203de..9fed86eab2 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala @@ -1,8 +1,9 @@ package org.enso.languageserver.protocol.json -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash, Status} +import akka.actor.{Actor, ActorRef, Props, Stash, Status} import akka.pattern.pipe import akka.util.Timeout +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.boot.resource.InitializationComponent import org.enso.languageserver.capability.CapabilityApi.{ @@ -94,7 +95,7 @@ class JsonConnectionController( requestTimeout: FiniteDuration = 10.seconds ) extends Actor with Stash - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -134,7 +135,7 @@ class JsonConnectionController( _, InitProtocolConnection.Params(clientId) ) => - log.info("Initializing resources.") + logger.info("Initializing resources.") mainComponent.init().pipeTo(self) context.become(initializing(webActor, clientId, req, sender())) @@ -152,7 +153,7 @@ class JsonConnectionController( receiver: ActorRef ): Receive = { case InitializationComponent.Initialized => - log.info("RPC session initialized for client [{}].", clientId) + logger.info("RPC session initialized for client [{}].", clientId) val session = JsonSession(clientId, self) context.system.eventStream.publish(JsonSessionInitialized(session)) val requestHandlers = createRequestHandlers(session) @@ -164,7 +165,7 @@ class JsonConnectionController( context.become(initialised(webActor, session, requestHandlers)) case Status.Failure(ex) => - log.error(ex, "Failed to initialize the resources. {}", ex.getMessage) + logger.error("Failed to initialize the resources. {}", ex.getMessage) receiver ! ResponseError(Some(request.id), ResourcesInitializationError) context.become(connected(webActor)) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/AcquireCapabilityHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/AcquireCapabilityHandler.scala index b497c8fb42..f61ef25dc8 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/AcquireCapabilityHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/AcquireCapabilityHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.capability -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.capability.CapabilityApi.AcquireCapability import org.enso.languageserver.capability.CapabilityProtocol @@ -28,7 +29,7 @@ class AcquireCapabilityHandler( timeout: FiniteDuration, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -52,7 +53,7 @@ class AcquireCapabilityHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error( + logger.error( "Acquiring capability for client [{}] timed out.", session.clientId ) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/ReleaseCapabilityHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/ReleaseCapabilityHandler.scala index 5925ad998d..534a66ba8f 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/ReleaseCapabilityHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/capability/ReleaseCapabilityHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.capability -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.capability.CapabilityApi.{ CapabilityNotAcquired, @@ -30,7 +31,7 @@ class ReleaseCapabilityHandler( timeout: FiniteDuration, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = requestStage @@ -50,7 +51,7 @@ class ReleaseCapabilityHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error( + logger.error( "Releasing capability for client [{}] timed out.", session.clientId ) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/CreateHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/CreateHandler.scala index 92cd924fe7..71ee4941c7 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/CreateHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/CreateHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.executioncontext -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.data.{ CanModify, @@ -29,7 +30,7 @@ class CreateHandler( contextRegistry: ActorRef, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ContextRegistryProtocol._ @@ -51,7 +52,7 @@ class CreateHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/DestroyHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/DestroyHandler.scala index 510b988e3a..14774cf7d1 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/DestroyHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/DestroyHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.executioncontext -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.ExecutionApi._ @@ -24,7 +25,7 @@ class DestroyHandler( contextRegistry: ActorRef, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ContextRegistryProtocol._ @@ -50,7 +51,7 @@ class DestroyHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PopHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PopHandler.scala index 050d9feb9e..2f7fc0a82b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PopHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PopHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.executioncontext -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.ExecutionApi._ @@ -24,7 +25,7 @@ class PopHandler( contextRegistry: ActorRef, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ContextRegistryProtocol._ @@ -46,7 +47,7 @@ class PopHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PushHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PushHandler.scala index 5edf16747e..247f590f9d 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PushHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/PushHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.executioncontext -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.ExecutionApi._ @@ -24,7 +25,7 @@ class PushHandler( contextRegistry: ActorRef, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ContextRegistryProtocol._ @@ -54,7 +55,7 @@ class PushHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/RecomputeHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/RecomputeHandler.scala index 5ec18687ac..f6199fb5e8 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/RecomputeHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/executioncontext/RecomputeHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.executioncontext -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.ExecutionApi._ @@ -24,7 +25,7 @@ class RecomputeHandler( contextRegistry: ActorRef, session: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ContextRegistryProtocol._ @@ -54,7 +55,7 @@ class RecomputeHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CopyFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CopyFileHandler.scala index 266b718db3..6fbf57029c 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CopyFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CopyFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -36,7 +37,7 @@ class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", CopyFile, MaskedString(ex.getMessage) @@ -46,7 +47,7 @@ class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CreateFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CreateFileHandler.scala index 07424d4d26..cfc0c19aa5 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CreateFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/CreateFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -36,7 +37,7 @@ class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", CreateFile, MaskedString(ex.getMessage) @@ -46,7 +47,7 @@ class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/DeleteFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/DeleteFileHandler.scala index 490d686462..93de3f40fb 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/DeleteFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/DeleteFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileDeletedEvent, @@ -17,7 +18,7 @@ import scala.concurrent.duration.FiniteDuration class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -39,7 +40,7 @@ class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) path: Path ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", DeleteFile, MaskedString(ex.getMessage) @@ -49,7 +50,7 @@ class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ExistsFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ExistsFileHandler.scala index 66e9b4cd78..15e1efe211 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ExistsFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ExistsFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -36,7 +37,7 @@ class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", ExistsFile, MaskedString(ex.getMessage) @@ -46,7 +47,7 @@ class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/InfoFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/InfoFileHandler.scala index 33cea392d4..0b7cfb517b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/InfoFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/InfoFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -20,7 +21,7 @@ import scala.concurrent.duration.FiniteDuration */ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -41,7 +42,7 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", InfoFile, MaskedString(ex.getMessage) @@ -51,7 +52,7 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ListFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ListFileHandler.scala index 3c4513b7d9..3eb88fdc1b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ListFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ListFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -36,7 +37,7 @@ class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", ListFile, MaskedString(ex.getMessage) @@ -46,7 +47,7 @@ class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/MoveFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/MoveFileHandler.scala index f93c6ebc80..158ae4f747 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/MoveFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/MoveFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -36,7 +37,7 @@ class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", MoveFile, MaskedString(ex.getMessage) @@ -46,7 +47,7 @@ class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadBinaryFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadBinaryFileHandler.scala index bd57bfa530..1d219de965 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadBinaryFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadBinaryFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.filemanager.{ FileManagerProtocol, FileSystemFailureMapper @@ -32,7 +33,7 @@ class ReadBinaryFileHandler( fileManager: ActorRef, replyTo: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -54,7 +55,7 @@ class ReadBinaryFileHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( s"Failure during ReadBinaryFile operation: {}", MaskedString(ex.getMessage) ) @@ -64,7 +65,7 @@ class ReadBinaryFileHandler( context.stop(self) case RequestTimeout => - log.error("Request ReadBinaryFile [{}] timed out.", requestId) + logger.error("Request ReadBinaryFile [{}] timed out.", requestId) val packet = ErrorFactory.createServiceError(Some(requestId)) replyTo ! packet context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadTextualFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadTextualFileHandler.scala index 8faff97eea..26ea902ffd 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadTextualFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/ReadTextualFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -17,7 +18,7 @@ class ReadTextualFileHandler( requestTimeout: FiniteDuration, fileManager: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -38,7 +39,7 @@ class ReadTextualFileHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", ReadFile, MaskedString(ex.getMessage) @@ -48,7 +49,7 @@ class ReadTextualFileHandler( context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/TreeFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/TreeFileHandler.scala index 2ae2e4ea14..e7c631afb5 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/TreeFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/TreeFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -36,7 +37,7 @@ class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during [{}] operation: {}", TreeFile, MaskedString(ex.getMessage) @@ -46,7 +47,7 @@ class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef) context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteBinaryFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteBinaryFileHandler.scala index d751bd4392..86dee3e177 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteBinaryFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteBinaryFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.filemanager.{ FileManagerProtocol, FileSystemFailureMapper @@ -32,7 +33,7 @@ class WriteBinaryFileHandler( fileManager: ActorRef, replyTo: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -57,7 +58,7 @@ class WriteBinaryFileHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( "Failure during WriteBinaryFile operation: {}", MaskedString(ex.getMessage) ) @@ -67,7 +68,7 @@ class WriteBinaryFileHandler( context.stop(self) case RequestTimeout => - log.error("Request WriteBinaryFile [{}] timed out.", requestId) + logger.error("Request WriteBinaryFile [{}] timed out.", requestId) val packet = ErrorFactory.createServiceError(Some(requestId)) replyTo ! packet context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteTextualFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteTextualFileHandler.scala index 28e1071197..772a83dd39 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteTextualFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/file/WriteTextualFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.file import akka.actor._ +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.{ FileManagerProtocol, @@ -17,7 +18,7 @@ class WriteTextualFileHandler( requestTimeout: FiniteDuration, fileManager: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -38,7 +39,7 @@ class WriteTextualFileHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error( + logger.error( s"Failure during [{}] operation: {}", WriteFile, MaskedString(ex.getMessage) @@ -48,7 +49,7 @@ class WriteTextualFileHandler( context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.ServiceError) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/FeedStandardInputHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/FeedStandardInputHandler.scala index babfa099f7..8a2402a98c 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/FeedStandardInputHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/FeedStandardInputHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.io -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.io.InputOutputApi.FeedStandardInput import org.enso.languageserver.io.InputOutputProtocol @@ -12,7 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging */ class FeedStandardInputHandler(stdInController: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdErrHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdErrHandler.scala index 831bd97890..555939786a 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdErrHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdErrHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.io -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.data.ClientId import org.enso.languageserver.io.InputOutputApi.RedirectStandardError @@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging */ class RedirectStdErrHandler(stdErrController: ActorRef, clientId: ClientId) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdOutHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdOutHandler.scala index b09d13e058..bfff59a5f1 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdOutHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/RedirectStdOutHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.io -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.data.ClientId import org.enso.languageserver.io.InputOutputApi.RedirectStandardOutput @@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging */ class RedirectStdOutHandler(stdOutController: ActorRef, clientId: ClientId) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdErrHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdErrHandler.scala index a2f414180a..c0529bb167 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdErrHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdErrHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.io -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.data.ClientId import org.enso.languageserver.io.InputOutputApi.SuppressStandardError @@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging */ class SuppressStdErrHandler(stdErrController: ActorRef, clientId: ClientId) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdOutHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdOutHandler.scala index 59ab61a4c4..caae65d7cd 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdOutHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/io/SuppressStdOutHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.io -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.data.ClientId import org.enso.languageserver.io.InputOutputApi.SuppressStandardOutput @@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging */ class SuppressStdOutHandler(stdOutController: ActorRef, clientId: ClientId) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/InitialPingHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/InitialPingHandler.scala index cf32e4e2ee..68edbb6709 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/InitialPingHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/InitialPingHandler.scala @@ -1,13 +1,14 @@ package org.enso.languageserver.requesthandler.monitoring -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.Errors.ServiceError import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult, Unused} import org.enso.languageserver.event.InitializedEvent import org.enso.languageserver.monitoring.MonitoringApi /** A request handler for `heartbeat/init` commands. */ -class InitialPingHandler extends Actor with ActorLogging { +class InitialPingHandler extends Actor with LazyLogging { override def preStart(): Unit = { context.system.eventStream.subscribe(self, classOf[InitializedEvent]) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/PingHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/PingHandler.scala index 5ad90e2b2b..5eafe5b2e7 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/PingHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/monitoring/PingHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.monitoring -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{ Errors, Id, @@ -25,7 +26,7 @@ class PingHandler( timeout: FiniteDuration, shouldReplyWhenTimedOut: Boolean ) extends Actor - with ActorLogging { + with LazyLogging { import context.dispatcher @@ -48,7 +49,7 @@ class PingHandler( count: Int = 0 ): Receive = { case RequestTimeout => - log.error( + logger.error( "Health check timed out. Only {}/{} subsystems replied on time.", count, subsystems.size diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/refactoring/RenameProjectHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/refactoring/RenameProjectHandler.scala index c66e686677..238d9d7646 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/refactoring/RenameProjectHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/refactoring/RenameProjectHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.requesthandler.refactoring import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.refactoring.ProjectNameChangedEvent import org.enso.languageserver.refactoring.RefactoringApi.RenameProject @@ -19,7 +20,7 @@ import scala.concurrent.duration.FiniteDuration */ class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -49,7 +50,7 @@ class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef) cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/CompletionHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/CompletionHandler.scala index 82fc239e56..4db967eb7b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/CompletionHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/CompletionHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.search -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.search.SearchApi.{ @@ -21,7 +22,7 @@ class CompletionHandler( timeout: FiniteDuration, suggestionsHandler: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -52,13 +53,13 @@ class CompletionHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Search completion error: {}", ex.getMessage) + logger.error("Search completion error.", ex) replyTo ! ResponseError(Some(id), SuggestionsDatabaseError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseHandler.scala index bb01ce7e76..040773fabe 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.search -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.search.SearchApi.{ @@ -21,7 +22,7 @@ class GetSuggestionsDatabaseHandler( timeout: FiniteDuration, suggestionsHandler: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -42,13 +43,13 @@ class GetSuggestionsDatabaseHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "GetSuggestionsDatabase error: {}", ex.getMessage) + logger.error("GetSuggestionsDatabase error.", ex) replyTo ! ResponseError(Some(id), SuggestionsDatabaseError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseVersionHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseVersionHandler.scala index 2895c425a9..a7d4e1ab99 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseVersionHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/GetSuggestionsDatabaseVersionHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.search -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.search.SearchApi.{ @@ -21,7 +22,7 @@ class GetSuggestionsDatabaseVersionHandler( timeout: FiniteDuration, suggestionsHandler: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -42,13 +43,13 @@ class GetSuggestionsDatabaseVersionHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "GetSuggestionsDatabaseVersion error: {}", ex.getMessage) + logger.error("GetSuggestionsDatabaseVersion error.", ex) replyTo ! ResponseError(Some(id), SuggestionsDatabaseError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/ImportHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/ImportHandler.scala index 80ae05a73d..2f752270a6 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/ImportHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/ImportHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.search -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.search.SearchApi.{ @@ -21,7 +22,7 @@ class ImportHandler( timeout: FiniteDuration, suggestionsHandler: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -42,13 +43,13 @@ class ImportHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Search import error: {}", ex.getMessage) + logger.error("Search import error.", ex) replyTo ! ResponseError(Some(id), SuggestionsDatabaseError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/InvalidateSuggestionsDatabaseHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/InvalidateSuggestionsDatabaseHandler.scala index a7f23af434..13644f5e6d 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/InvalidateSuggestionsDatabaseHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/search/InvalidateSuggestionsDatabaseHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.search -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ class InvalidateSuggestionsDatabaseHandler( timeout: FiniteDuration, suggestionsHandler: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -46,13 +47,13 @@ class InvalidateSuggestionsDatabaseHandler( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "InvalidateSuggestionsDatabase error: {}", ex.getMessage) + logger.error("InvalidateSuggestionsDatabase error.", ex) replyTo ! ResponseError(Some(id), SuggestionsDatabaseError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/session/InitProtocolConnectionHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/session/InitProtocolConnectionHandler.scala index 1709b25442..854bce14db 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/session/InitProtocolConnectionHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/session/InitProtocolConnectionHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.session -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Errors, Id, Request, ResponseError, ResponseResult} import org.enso.languageserver.filemanager.FileManagerProtocol import org.enso.languageserver.filemanager.FileManagerProtocol.ContentRootsResult @@ -19,7 +20,7 @@ class InitProtocolConnectionHandler( fileManager: ActorRef, timeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -40,7 +41,7 @@ class InitProtocolConnectionHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Getting content roots request [{}] timed out.", id) + logger.error("Getting content roots request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/ApplyEditHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/ApplyEditHandler.scala index 56bc4bdd65..a216b65b70 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/ApplyEditHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/ApplyEditHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.text -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.session.JsonSession @@ -22,7 +23,7 @@ class ApplyEditHandler( timeout: FiniteDuration, rpcSession: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -43,7 +44,7 @@ class ApplyEditHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error( + logger.error( "Applying edit request [{}] for [{}] timed out.", id, rpcSession.clientId diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/CloseFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/CloseFileHandler.scala index d74b27549b..be61ec9eef 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/CloseFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/CloseFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.text -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.session.JsonSession @@ -22,7 +23,7 @@ class CloseFileHandler( timeout: FiniteDuration, rpcSession: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -43,7 +44,7 @@ class CloseFileHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error( + logger.error( "Closing file request [{}] for [{}] timed out.", id, rpcSession.clientId diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/OpenFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/OpenFileHandler.scala index 38150bc94d..16a6a6af2d 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/OpenFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/OpenFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.text -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Errors, Id, Request, ResponseError, ResponseResult} import org.enso.languageserver.filemanager.FileSystemFailureMapper import org.enso.languageserver.requesthandler.RequestTimeout @@ -26,7 +27,7 @@ class OpenFileHandler( timeout: FiniteDuration, rpcSession: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -47,7 +48,7 @@ class OpenFileHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error( + logger.error( "Opening file request [{}] for [{}] timed out.", id, rpcSession.clientId diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/SaveFileHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/SaveFileHandler.scala index 5acb6b6d2e..72ac5aa8fa 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/SaveFileHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/text/SaveFileHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.text -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.filemanager.FileSystemFailureMapper import org.enso.languageserver.requesthandler.RequestTimeout @@ -28,7 +29,7 @@ class SaveFileHandler( timeout: FiniteDuration, rpcSession: JsonSession ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -53,7 +54,7 @@ class SaveFileHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error( + logger.error( "Saving file request [{}] for [{}] timed out.", id, rpcSession.clientId diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/AttachVisualisationHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/AttachVisualisationHandler.scala index a7d938a7d5..f2171e4b39 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/AttachVisualisationHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/AttachVisualisationHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.visualisation -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.data.ClientId import org.enso.languageserver.requesthandler.RequestTimeout @@ -24,7 +25,7 @@ class AttachVisualisationHandler( timeout: FiniteDuration, contextRegistry: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -50,7 +51,7 @@ class AttachVisualisationHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/DetachVisualisationHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/DetachVisualisationHandler.scala index 22da00b4e5..2788f38165 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/DetachVisualisationHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/DetachVisualisationHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.visualisation -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.data.ClientId import org.enso.languageserver.requesthandler.RequestTimeout @@ -24,7 +25,7 @@ class DetachVisualisationHandler( timeout: FiniteDuration, contextRegistry: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -50,7 +51,7 @@ class DetachVisualisationHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ExecuteExpressionHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ExecuteExpressionHandler.scala index c9c94ac0ae..65248d39b1 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ExecuteExpressionHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ExecuteExpressionHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.visualisation -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.data.ClientId import org.enso.languageserver.requesthandler.RequestTimeout @@ -24,7 +25,7 @@ class ExecuteExpressionHandler( timeout: FiniteDuration, contextRegistry: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -54,7 +55,7 @@ class ExecuteExpressionHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ModifyVisualisationHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ModifyVisualisationHandler.scala index 7956294a62..af2b8f592d 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ModifyVisualisationHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/visualisation/ModifyVisualisationHandler.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.requesthandler.visualisation -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc._ import org.enso.languageserver.data.ClientId import org.enso.languageserver.requesthandler.RequestTimeout @@ -24,7 +25,7 @@ class ModifyVisualisationHandler( timeout: FiniteDuration, contextRegistry: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -49,7 +50,7 @@ class ModifyVisualisationHandler( cancellable: Cancellable ): Receive = { case RequestTimeout => - log.error("Request [{}] timed out.", id) + logger.error("Request [{}] timed out.", id) replyTo ! ResponseError(Some(id), Errors.RequestTimeout) context.stop(self) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala index 681f55af02..1a7cd5a3ef 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala @@ -1,7 +1,8 @@ package org.enso.languageserver.requesthandler.workspace -import akka.actor.{Actor, ActorLogging, Props} +import akka.actor.{Actor, Props} import buildinfo.Info +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseError, ResponseResult} import org.enso.languageserver.data.Config import org.enso.languageserver.filemanager.FileManagerApi @@ -9,7 +10,6 @@ import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.workspace.WorkspaceApi.ProjectInfo import org.enso.logger.masking.MaskedPath import org.enso.pkg.{Config => PkgConfig} - import java.io.{File, FileInputStream} import java.nio.charset.StandardCharsets @@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets */ class ProjectInfoHandler(languageServerConfig: Config) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = { case Request(ProjectInfo, id, _) => @@ -43,14 +43,14 @@ class ProjectInfoHandler(languageServerConfig: Config) projectInfo ) } else { - log.error( + logger.error( "Could not decode the package configuration at [{}].", MaskedPath(configFile.toPath) ) sender() ! ResponseError(Some(id), FileManagerApi.CannotDecodeError) } } else { - log.error( + logger.error( "Could not find the package configuration in the project at [{}].", MaskedPath(projectRoot.toPath) ) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala index 49689a7f4d..8c089bb218 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala @@ -1,7 +1,8 @@ package org.enso.languageserver.runtime -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.runtime.ContextRegistryProtocol.{ DetachVisualisation, @@ -43,7 +44,7 @@ final class ContextEventsListener( sessionRouter: ActorRef, updatesSendRate: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import ContextEventsListener.RunExpressionUpdates @@ -195,7 +196,7 @@ final class ContextEventsListener( methodPointerToSuggestion.get(pointer) match { case suggestionId @ Some(_) => suggestionId case None => - log.error("Unable to find suggestion for [{}].", pointer) + logger.error("Unable to find suggestion for [{}].", pointer) None } }, diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala index 8f104b15b0..9373205a7b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.{ClientId, Config} import org.enso.languageserver.event.{ ExecutionContextCreated, @@ -62,7 +63,7 @@ final class ContextRegistry( runtime: ActorRef, sessionRouter: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with ActorMessageLogging with UnhandledLogging { diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala index 14dc133225..7e9a79ff32 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime import java.nio.ByteBuffer -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash} +import akka.actor.{Actor, ActorRef, Props, Stash} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.runtime.RuntimeConnector.Destroy import org.enso.polyglot.runtime.Runtime @@ -12,17 +13,17 @@ import org.graalvm.polyglot.io.MessageEndpoint */ class RuntimeConnector extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging with Stash { override def preStart(): Unit = { - log.info("Starting the runtime connector.") + logger.info("Starting the runtime connector.") } override def receive: Receive = { case RuntimeConnector.Initialize(engine) => - log.info( + logger.info( s"Runtime connector established connection with the message endpoint [{}].", engine ) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeKiller.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeKiller.scala index bf98afc560..1948f5ad66 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeKiller.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeKiller.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.runtime.RuntimeKiller._ import org.enso.languageserver.util.UnhandledLogging import org.enso.polyglot.runtime.Runtime.Api @@ -20,7 +21,7 @@ import scala.util.control.NonFatal */ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -28,7 +29,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context) override def receive: Receive = idle() private def idle(): Receive = { case ShutDownRuntime => - log.info("Shutting down the runtime server [{}].", runtimeConnector) + logger.info("Shutting down the runtime server [{}].", runtimeConnector) runtimeConnector ! Api.Request( UUID.randomUUID(), Api.ShutDownRuntimeServer() @@ -44,7 +45,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context) cancellable: Cancellable ): Receive = { case ResourceDisposalTimeout => - log.error("Disposal of runtime resources timed out.") + logger.error("Disposal of runtime resources timed out.") shutDownTruffle(replyTo) case Api.Response(_, Api.RuntimeServerShutDown()) => @@ -61,7 +62,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context) private def shutDownTruffle(replyTo: ActorRef, retryCount: Int = 0): Unit = { try { - log.info( + logger.info( "Shutting down the Truffle context [{}]. " + "Attempt #{}.", truffleContext, @@ -72,8 +73,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context) context.stop(self) } catch { case NonFatal(ex) => - log.error( - ex, + logger.error( s"An error occurred during stopping Truffle context [{}]. {}", truffleContext, ex.getMessage diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/AttachVisualisationHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/AttachVisualisationHandler.scala index fcd6b4e1d0..8529e6a39d 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/AttachVisualisationHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/AttachVisualisationHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ class AttachVisualisationHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/CreateContextHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/CreateContextHandler.scala index e13f52ffc3..0deb99f014 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/CreateContextHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/CreateContextHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ final class CreateContextHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher, ContextRegistryProtocol._ diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DestroyContextHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DestroyContextHandler.scala index 998cc66672..77e4e0f44a 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DestroyContextHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DestroyContextHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ final class DestroyContextHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher, ContextRegistryProtocol._ diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DetachVisualisationHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DetachVisualisationHandler.scala index 2adf97504c..602046b40b 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DetachVisualisationHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/DetachVisualisationHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ class DetachVisualisationHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/ModifyVisualisationHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/ModifyVisualisationHandler.scala index 5389e11b99..30e6292120 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/ModifyVisualisationHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/ModifyVisualisationHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ class ModifyVisualisationHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PopContextHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PopContextHandler.scala index ed77852fd3..a7c8034f84 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PopContextHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PopContextHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ final class PopContextHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PushContextHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PushContextHandler.scala index 6e16b0d50b..f5d11547bd 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PushContextHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/PushContextHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ final class PushContextHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/RecomputeContextHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/RecomputeContextHandler.scala index 7765792218..831bc2a103 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/RecomputeContextHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/handler/RecomputeContextHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.{ @@ -25,7 +26,7 @@ final class RecomputeContextHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher, ContextRegistryProtocol._ diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala index 54bf376bb1..7fc02b24a4 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala @@ -2,8 +2,9 @@ package org.enso.languageserver.search import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash} +import akka.actor.{Actor, ActorRef, Props, Stash} import akka.pattern.{ask, pipe} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.capability.CapabilityProtocol.{ AcquireCapability, CapabilityAcquired, @@ -84,7 +85,7 @@ final class SuggestionsHandler( runtimeConnector: ActorRef ) extends Actor with Stash - with ActorLogging + with LazyLogging with UnhandledLogging { import SuggestionsHandler.ProjectNameUpdated @@ -93,7 +94,7 @@ final class SuggestionsHandler( private val timeout = config.executionContext.requestTimeout override def preStart(): Unit = { - log.info( + logger.info( "Starting suggestions handler from [{}, {}, {}].", config, suggestionsRepo, @@ -122,7 +123,7 @@ final class SuggestionsHandler( def initializing(init: SuggestionsHandler.Initialization): Receive = { case ProjectNameChangedEvent(oldName, newName) => - log.info( + logger.info( "Initializing: project name changed from [{}] to [{}].", oldName, newName @@ -133,12 +134,12 @@ final class SuggestionsHandler( .pipeTo(self) case ProjectNameUpdated(name, updates) => - log.info("Initializing: project name is updated to [{}].", name) + logger.info("Initializing: project name is updated to [{}].", name) updates.foreach(sessionRouter ! _) tryInitialize(init.copy(project = Some(name))) case InitializedEvent.SuggestionsRepoInitialized => - log.info("Initializing: suggestions repo initialized.") + logger.info("Initializing: suggestions repo initialized.") tryInitialize( init.copy(suggestions = Some(InitializedEvent.SuggestionsRepoInitialized) @@ -146,14 +147,14 @@ final class SuggestionsHandler( ) case InitializedEvent.TruffleContextInitialized => - log.info("Initializing: Truffle context initialized.") + logger.info("Initializing: Truffle context initialized.") val requestId = UUID.randomUUID() runtimeConnector .ask(Api.Request(requestId, Api.GetTypeGraphRequest()))(timeout, self) .pipeTo(self) case Api.Response(_, Api.GetTypeGraphResponse(g)) => - log.info("Initializing: got type graph response.") + logger.info("Initializing: got type graph response.") tryInitialize(init.copy(typeGraph = Some(g))) case _ => stash() @@ -164,14 +165,14 @@ final class SuggestionsHandler( graph: TypeGraph ): Receive = { case Api.Response(_, Api.VerifyModulesIndexResponse(toRemove)) => - log.info("Verifying: got verification response.") + logger.info("Verifying: got verification response.") suggestionsRepo .removeModules(toRemove) .map(_ => SuggestionsHandler.Verified) .pipeTo(self) case SuggestionsHandler.Verified => - log.info("Verified.") + logger.info("Verified.") context.become(initialized(projectName, graph, Set())) unstashAll() @@ -218,8 +219,7 @@ final class SuggestionsHandler( } case Success(None) => case Failure(ex) => - log.error( - ex, + logger.error( "Error applying suggestion database updates [{}, {}]. {}", MaskedPath(msg.file.toPath), msg.version, @@ -228,7 +228,7 @@ final class SuggestionsHandler( } case Api.ExpressionUpdates(_, updates) => - log.debug( + logger.debug( "Received expression updates [{}].", updates.map(u => (u.expressionId, u.expressionType)) ) @@ -254,8 +254,7 @@ final class SuggestionsHandler( } } case Failure(ex) => - log.error( - ex, + logger.error( "Error applying changes from computed values [{}]. {}", updates.map(_.expressionId), ex.getMessage @@ -330,13 +329,12 @@ final class SuggestionsHandler( } } case Success(Left(err)) => - log.error( + logger.error( s"Error cleaning the index after file delete event [{}].", err ) case Failure(ex) => - log.error( - ex, + logger.error( "Error cleaning the index after file delete event. {}", ex.getMessage ) @@ -415,7 +413,7 @@ final class SuggestionsHandler( private def tryInitialize(state: SuggestionsHandler.Initialization): Unit = { state.initialized.fold(context.become(initializing(state))) { case (name, graph) => - log.debug("Initialized with state [{}].", state) + logger.debug("Initialized with state [{}].", state) val requestId = UUID.randomUUID() suggestionsRepo.getAllModules .flatMap { modules => @@ -455,11 +453,11 @@ final class SuggestionsHandler( action match { case Api.SuggestionAction.Add() => if (ids.isEmpty) - log.error("Failed to {} [{}].", verb, suggestion) + logger.error("Failed to {} [{}].", verb, suggestion) ids.map(id => SuggestionsDatabaseUpdate.Add(id, suggestion)) case Api.SuggestionAction.Remove() => if (ids.isEmpty) - log.error(s"Failed to {} [{}].", verb, suggestion) + logger.error(s"Failed to {} [{}].", verb, suggestion) ids.map(id => SuggestionsDatabaseUpdate.Remove(id)) case m: Api.SuggestionAction.Modify => ids.map { id => diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/ImportModuleHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/ImportModuleHandler.scala index 11783211d3..be1d32ebf6 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/ImportModuleHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/ImportModuleHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.search.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.RuntimeFailureMapper @@ -23,7 +24,7 @@ final class ImportModuleHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala index 848a3f7f9a..4be11475ca 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala @@ -2,7 +2,8 @@ package org.enso.languageserver.search.handler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props} +import akka.actor.{Actor, ActorRef, Cancellable, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.data.Config import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.runtime.RuntimeFailureMapper @@ -23,7 +24,7 @@ final class InvalidateModulesIndexHandler( timeout: FiniteDuration, runtime: ActorRef ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/text/BufferRegistry.scala b/engine/language-server/src/main/scala/org/enso/languageserver/text/BufferRegistry.scala index fd202e932a..d2237bc3f7 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/text/BufferRegistry.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/text/BufferRegistry.scala @@ -1,6 +1,7 @@ package org.enso.languageserver.text -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash, Terminated} +import akka.actor.{Actor, ActorRef, Props, Stash, Terminated} +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.capability.CapabilityProtocol.{ AcquireCapability, CapabilityAcquisitionBadRequest, @@ -68,11 +69,11 @@ class BufferRegistry( versionCalculator: ContentBasedVersioning ) extends Actor with Stash - with ActorLogging + with LazyLogging with UnhandledLogging { override def preStart(): Unit = { - log.info("Starting initialization.") + logger.info("Starting initialization.") context.system.eventStream .subscribe(self, InitializedEvent.FileVersionsRepoInitialized.getClass) } @@ -81,7 +82,7 @@ class BufferRegistry( private def initializing: Receive = { case InitializedEvent.FileVersionsRepoInitialized => - log.info("Initiaized.") + logger.info("Initiaized.") context.become(running(Map.empty)) unstashAll() diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/text/CollaborativeBuffer.scala b/engine/language-server/src/main/scala/org/enso/languageserver/text/CollaborativeBuffer.scala index 6ca583b9a8..ce1e0acb5e 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/text/CollaborativeBuffer.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/text/CollaborativeBuffer.scala @@ -1,8 +1,9 @@ package org.enso.languageserver.text -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Stash} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Stash} import akka.pattern.pipe import cats.implicits._ +import com.typesafe.scalalogging.LazyLogging import org.enso.languageserver.capability.CapabilityProtocol._ import org.enso.languageserver.data.{CanEdit, CapabilityRegistration, ClientId} import org.enso.languageserver.event.{ @@ -53,7 +54,7 @@ class CollaborativeBuffer( versionCalculator: ContentBasedVersioning ) extends Actor with Stash - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -67,7 +68,11 @@ class CollaborativeBuffer( private def uninitialized: Receive = { case OpenFile(client, path) => context.system.eventStream.publish(BufferOpened(path)) - log.info("Buffer opened for [path:{}, client:{}].", path, client.clientId) + logger.info( + "Buffer opened for [path:{}, client:{}].", + path, + client.clientId + ) readFile(client, path) } diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala b/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala index a4f25c0789..ae75d1f369 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala @@ -1,10 +1,18 @@ package org.enso.languageserver.util -import akka.actor.{Actor, ActorLogging} +import akka.actor.Actor +import com.typesafe.scalalogging.LazyLogging +import org.enso.loggingservice.LogLevel -trait UnhandledLogging { this: Actor with ActorLogging => +trait UnhandledLogging extends LazyLogging { this: Actor => - override def unhandled(message: Any): Unit = - log.warning("Received unknown message: {}", message) + private val akkaLogLevel = LogLevel + .fromString(context.system.settings.LogLevel) + .getOrElse(LogLevel.Error) + override def unhandled(message: Any): Unit = { + if (implicitly[Ordering[LogLevel]].lteq(LogLevel.Warning, akkaLogLevel)) { + logger.warn("Received unknown message: {}", message.getClass) + } + } } diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/HeartbeatSession.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/HeartbeatSession.scala index 2495c22ad1..5459728b8d 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/HeartbeatSession.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/HeartbeatSession.scala @@ -2,8 +2,9 @@ package org.enso.projectmanager.infrastructure.languageserver import java.util.UUID -import akka.actor.{Actor, ActorLogging, Cancellable, Props, Scheduler} +import akka.actor.{Actor, Cancellable, Props, Scheduler} import akka.stream.SubscriptionWithCancelException.StageWasCompleted +import com.typesafe.scalalogging.LazyLogging import io.circe.parser._ import org.enso.projectmanager.data.Socket import org.enso.projectmanager.infrastructure.http.WebSocketConnection.{ @@ -47,7 +48,7 @@ class HeartbeatSession( sendConfirmations: Boolean, quietErrors: Boolean ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -59,14 +60,14 @@ class HeartbeatSession( override def preStart(): Unit = { connection.attachListener(self) connection.connect() - log.debug("Heartbeat connection initialized [{}].", socket) + logger.debug("Heartbeat connection initialized [{}].", socket) } override def receive: Receive = pingStage private def pingStage: Receive = { case WebSocketConnected => - log.debug("Sending ping message to {}.", socket) + logger.debug("Sending ping message to {}.", socket) connection.send(s""" |{ | "jsonrpc": "2.0", @@ -102,7 +103,7 @@ class HeartbeatSession( case Right(id) => if (id == requestId.toString) { - log.debug("Received correct pong message from {}.", socket) + logger.debug("Received correct pong message from {}.", socket) if (sendConfirmations) { context.parent ! HeartbeatReceived @@ -111,12 +112,12 @@ class HeartbeatSession( cancellable.cancel() stop() } else { - log.warning("Received unknown response {}.", payload) + logger.warn("Received unknown response {}.", payload) } } case HeartbeatTimeout => - log.debug("Heartbeat timeout detected for {}.", requestId) + logger.debug("Heartbeat timeout detected for {}.", requestId) context.parent ! ServerUnresponsive stop() @@ -166,25 +167,25 @@ class HeartbeatSession( arg: AnyRef ): Unit = { if (quietErrors) { - log.debug(s"$message ($throwable)", arg) + logger.debug(s"$message ($throwable)", arg) } else { - log.error(throwable, message, arg) + logger.error(s"$message {}", arg, throwable.getMessage) } } private def logError(throwable: Throwable, message: String): Unit = { if (quietErrors) { - log.debug(s"$message ($throwable)") + logger.debug(s"$message ($throwable)") } else { - log.error(throwable, message) + logger.error(message, throwable) } } private def logError(message: String): Unit = { if (quietErrors) { - log.debug(message) + logger.debug(message) } else { - log.error(message) + logger.error(message) } } diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala index 1a0d0b89eb..6c1e55fc7d 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala @@ -1,6 +1,7 @@ package org.enso.projectmanager.infrastructure.languageserver -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.logger.akka.ActorMessageLogging import org.enso.projectmanager.boot.configuration.BootloaderConfig import org.enso.projectmanager.infrastructure.languageserver.LanguageServerBootLoader.{ @@ -41,7 +42,7 @@ class LanguageServerBootLoader( bootTimeout: FiniteDuration, executor: LanguageServerExecutor ) extends Actor - with ActorLogging + with LazyLogging with ActorMessageLogging with UnhandledLogging { @@ -52,7 +53,7 @@ class LanguageServerBootLoader( import context.dispatcher override def preStart(): Unit = { - log.info("Booting a language server [{}].", descriptor) + logger.info("Booting a language server [{}].", descriptor) self ! FindFreeSocket } @@ -65,13 +66,15 @@ class LanguageServerBootLoader( private def findingSocket(retry: Int = 0): Receive = LoggingReceive.withLabel("findingSocket") { case FindFreeSocket => - log.debug("Looking for available socket to bind the language server.") + logger.debug( + "Looking for available socket to bind the language server." + ) val jsonRpcPort = findPort() var binaryPort = findPort() while (binaryPort == jsonRpcPort) { binaryPort = findPort() } - log.info( + logger.info( "Found sockets for the language server " + "[json:{}:{}, binary:{}:{}].", descriptor.networkConfig.interface, @@ -126,7 +129,7 @@ class LanguageServerBootLoader( bootRequester: ActorRef ): Receive = { case Boot => - log.debug("Booting a language server.") + logger.debug("Booting a language server.") context.actorOf( LanguageServerProcess.props( progressTracker = bootProgressTracker, @@ -164,7 +167,7 @@ class LanguageServerBootLoader( rpcPort = rpcPort, dataPort = dataPort ) - log.info("Language server booted [{}].", connectionInfo) + logger.info("Language server booted [{}].", connectionInfo) bootRequester ! ServerBooted(connectionInfo, self) context.become(running(connectionInfo)) @@ -182,7 +185,7 @@ class LanguageServerBootLoader( private def running(connectionInfo: LanguageServerConnectionInfo): Receive = LoggingReceive.withLabel("running") { case msg @ LanguageServerProcess.ServerTerminated(exitCode) => - log.debug( + logger.debug( "Language Server process has terminated with exit code {}.", exitCode ) @@ -213,7 +216,7 @@ class LanguageServerBootLoader( ): Receive = LoggingReceive.withLabel("restartingWaitingForShutdown") { case LanguageServerProcess.ServerTerminated(exitCode) => - log.debug( + logger.debug( "Language Server process has terminated (as requested to reboot) " + "with exit code {}.", exitCode @@ -256,7 +259,7 @@ class LanguageServerBootLoader( message: String, throwable: Option[Throwable] ): Unit = { - log.warning(message) + logger.warn(message) if (shouldRetry && retryCount < config.numberOfRetries) { context.system.scheduler @@ -264,12 +267,12 @@ class LanguageServerBootLoader( context.become(findingSocket(retryCount + 1)) } else { if (shouldRetry) { - log.error( + logger.error( "Tried {} times to boot Language Server. Giving up.", retryCount ) } else { - log.error("Failed to restart the server. Giving up.") + logger.error("Failed to restart the server. Giving up.") } bootRequester ! ServerBootFailed( throwable.getOrElse(new RuntimeException(message)) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala index 30e1123bf6..96290a0816 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala @@ -4,7 +4,6 @@ import java.util.UUID import akka.actor.{ Actor, - ActorLogging, ActorRef, Cancellable, OneForOneStrategy, @@ -13,6 +12,7 @@ import akka.actor.{ SupervisorStrategy, Terminated } +import com.typesafe.scalalogging.LazyLogging import nl.gn0s1s.bump.SemVer import org.enso.logger.akka.ActorMessageLogging import org.enso.projectmanager.boot.configuration.{ @@ -65,7 +65,7 @@ class LanguageServerController( loggingServiceDescriptor: LoggingServiceDescriptor, executor: LanguageServerExecutor ) extends Actor - with ActorLogging + with LazyLogging with ActorMessageLogging with Stash with UnhandledLogging { @@ -119,12 +119,12 @@ class LanguageServerController( private def booting(Bootloader: ActorRef): Receive = LoggingReceive.withLabel("booting") { case BootTimeout => - log.error("Booting failed for {}.", descriptor) + logger.error("Booting failed for {}.", descriptor) unstashAll() context.become(bootFailed(LanguageServerProtocol.ServerBootTimedOut)) case ServerBootFailed(th) => - log.error(th, "Booting failed for {}.", descriptor) + logger.error("Booting failed for {}. {}", descriptor, th.getMessage) unstashAll() context.become(bootFailed(LanguageServerProtocol.ServerBootFailed(th))) @@ -143,7 +143,7 @@ class LanguageServerController( ) case Terminated(Bootloader) => - log.error("Bootloader for project {} failed.", project.name) + logger.error("Bootloader for project {} failed.", project.name) unstashAll() context.become( bootFailed( @@ -188,7 +188,7 @@ class LanguageServerController( ) } case Terminated(_) => - log.debug("Bootloader for {} terminated.", project) + logger.debug("Bootloader for {} terminated.", project) case StopServer(clientId, _) => removeClient( @@ -228,7 +228,7 @@ class LanguageServerController( ) case ServerDied => - log.error("Language server died [{}].", connectionInfo) + logger.error("Language server died [{}].", connectionInfo) context.stop(self) } @@ -252,7 +252,7 @@ class LanguageServerController( } private def shutDownServer(maybeRequester: Option[ActorRef]): Unit = { - log.debug("Shutting down a language server for project {}.", project.id) + logger.debug("Shutting down a language server for project {}.", project.id) context.children.foreach(_ ! GracefulStop) val cancellable = context.system.scheduler @@ -274,9 +274,9 @@ class LanguageServerController( case LanguageServerProcess.ServerTerminated(exitCode) => cancellable.cancel() if (exitCode == 0) { - log.info("Language server shut down successfully [{}].", project) + logger.info("Language server shut down successfully [{}].", project) } else { - log.warning( + logger.warn( "Language server shut down with non-zero exit code: {} [{}].", exitCode, project @@ -286,7 +286,7 @@ class LanguageServerController( stop() case ShutdownTimeout => - log.error("Language server shutdown timed out.") + logger.error("Language server shutdown timed out.") maybeRequester.foreach(_ ! ServerShutdownTimedOut) stop() diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerKiller.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerKiller.scala index 2c7dfd20b1..a0b51b6c62 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerKiller.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerKiller.scala @@ -1,14 +1,7 @@ package org.enso.projectmanager.infrastructure.languageserver -import akka.actor.{ - Actor, - ActorLogging, - ActorRef, - Cancellable, - PoisonPill, - Props, - Terminated -} +import akka.actor.{Actor, ActorRef, Cancellable, PoisonPill, Props, Terminated} +import com.typesafe.scalalogging.LazyLogging import org.enso.projectmanager.infrastructure.languageserver.LanguageServerController.ShutDownServer import org.enso.projectmanager.infrastructure.languageserver.LanguageServerKiller.KillTimeout import org.enso.projectmanager.infrastructure.languageserver.LanguageServerProtocol.{ @@ -30,7 +23,7 @@ class LanguageServerKiller( controllers: List[ActorRef], shutdownTimeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -40,7 +33,7 @@ class LanguageServerKiller( sender() ! AllServersKilled context.stop(self) } else { - log.info("Killing all servers [{}].", controllers) + logger.info("Killing all servers [{}].", controllers) controllers.foreach(context.watch) controllers.foreach(_ ! ShutDownServer) val cancellable = @@ -61,7 +54,7 @@ class LanguageServerKiller( case Terminated(dead) => val updated = liveControllers - dead if (updated.isEmpty) { - log.info("All language servers have been killed.") + logger.info("All language servers have been killed.") cancellable.cancel() replyTo ! AllServersKilled context.stop(self) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerRegistry.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerRegistry.scala index d6a42ad8e8..22f36abbd4 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerRegistry.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerRegistry.scala @@ -2,7 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Terminated} +import akka.actor.{Actor, ActorRef, Props, Terminated} +import com.typesafe.scalalogging.LazyLogging import org.enso.projectmanager.boot.configuration.{ BootloaderConfig, NetworkConfig, @@ -48,7 +49,7 @@ class LanguageServerRegistry( loggingServiceDescriptor: LoggingServiceDescriptor, executor: LanguageServerExecutor ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = running() diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisor.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisor.scala index 6c77b277a9..44b1ce32d8 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisor.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisor.scala @@ -2,15 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver import java.util.UUID -import akka.actor.{ - Actor, - ActorLogging, - ActorRef, - Cancellable, - Props, - Scheduler, - Terminated -} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Scheduler, Terminated} +import com.typesafe.scalalogging.LazyLogging import org.enso.projectmanager.boot.configuration.SupervisionConfig import org.enso.projectmanager.data.Socket import org.enso.projectmanager.infrastructure.http.WebSocketConnectionFactory @@ -44,7 +37,7 @@ class LanguageServerSupervisor( connectionFactory: WebSocketConnectionFactory, scheduler: Scheduler ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -83,7 +76,7 @@ class LanguageServerSupervisor( case ServerUnresponsive => cancellable.cancel() - log.info("Server is unresponsive. Restarting [{}].", connectionInfo) + logger.info("Server is unresponsive. Restarting [{}].", connectionInfo) serverProcessManager ! Restart context.become(restarting) @@ -94,18 +87,18 @@ class LanguageServerSupervisor( private def restarting: Receive = { case ServerBootFailed(_) => - log.error("Cannot restart language server.") + logger.error("Cannot restart language server.") context.parent ! ServerDied context.stop(self) case ServerBooted(_, newProcessManager) => if (newProcessManager != serverProcessManager) { - log.error( + logger.error( "The process manager actor has changed. This should never happen. " + "Supervisor may no longer work correctly." ) } - log.info("Language server restarted [{}].", connectionInfo) + logger.info("Language server restarted [{}].", connectionInfo) val cancellable = scheduler.scheduleAtFixedRate( supervisionConfig.initialDelay, diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameAction.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameAction.scala index d0f40d5e4e..6465c0b1fe 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameAction.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameAction.scala @@ -2,8 +2,9 @@ package org.enso.projectmanager.infrastructure.languageserver import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Scheduler} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Scheduler} import akka.stream.SubscriptionWithCancelException.StageWasCompleted +import com.typesafe.scalalogging.LazyLogging import io.circe import io.circe.Json import io.circe.parser.parse @@ -50,7 +51,7 @@ class ProjectRenameAction( newName: String, scheduler: Scheduler ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.{dispatcher, system} @@ -64,7 +65,7 @@ class ProjectRenameAction( private var maybeActionTimeoutCancellable: Option[Cancellable] = None override def preStart(): Unit = { - log.info("Requesting a Language Server to rename project [{}].", oldName) + logger.info("Requesting a Language Server to rename project [{}].", oldName) connection.attachListener(self) connection.connect() val cancellable = @@ -92,21 +93,22 @@ class ProjectRenameAction( context.become(connected()) case WebSocketStreamFailure(th) => - log.error( - th, - "An error occurred during connecting to websocket {}.", - socket + logger.error( + s"An error occurred during connecting to websocket $socket.", + th ) replyTo ! CannotConnectToServer stop() case ActionTimeout => - log.error("Action timeout occurred. Stopping actor.") + logger.error("Action timeout occurred. Stopping actor.") replyTo ! RenameTimeout stop() case GracefulStop => - log.warning("Ignoring stop command (Language Server is not connected).") + logger.warn( + "Ignoring stop command (Language Server is not connected)." + ) } private def connected(): Receive = { @@ -126,17 +128,17 @@ class ProjectRenameAction( maybeActionTimeoutCancellable.foreach(_.cancel()) case WebSocketStreamFailure(th) => - log.error(th, "An error occurred during waiting for Pong message.") + logger.error("An error occurred during waiting for Pong message.", th) replyTo ! ServerUnresponsive stop() case ActionTimeout => - log.error("Action timeout occurred. Stopping actor.") + logger.error("Action timeout occurred. Stopping actor.") replyTo ! RenameTimeout stop() case GracefulStop => - log.warning("Ignoring stop command (Language Server is connected).") + logger.warn("Ignoring stop command (Language Server is connected).") } private def handleSuccess(payload: String): Unit = { @@ -145,15 +147,15 @@ class ProjectRenameAction( maybeRequestId match { case Left(error) => - log.error(error, "An error occurred during parsing rename reply.") + logger.error("An error occurred during parsing rename reply.", error) case Right(id) => if (id == requestId.toString) { - log.info("Project renamed by the Language Server.") + logger.info("Project renamed by the Language Server.") replyTo ! ProjectRenamed stop() } else { - log.warning("Received unknown response [{}].", payload) + logger.warn("Received unknown response [{}].", payload) } } } @@ -164,7 +166,7 @@ class ProjectRenameAction( val msg = maybeError .flatMap(_.hcursor.downField("message").as[String]) .getOrElse("Not Provided") - log.error( + logger.error( "Error occurred during renaming project [code: {}, message: {}]", code, msg @@ -181,16 +183,16 @@ class ProjectRenameAction( closureTimeoutCancellable.cancel() case WebSocketStreamFailure(th) => - log.error(th, "An error occurred during closing web socket.") + logger.error("An error occurred during closing web socket.", th) context.stop(self) closureTimeoutCancellable.cancel() case SocketClosureTimeout => - log.error("Socket closure timed out.") + logger.error("Socket closure timed out.") context.stop(self) case GracefulStop => - log.warning( + logger.warn( "Ignoring stop command (closing connection to Language Server)." ) } diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivationWatcher.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivationWatcher.scala index 53cb7a1bb5..a5128ea501 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivationWatcher.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivationWatcher.scala @@ -1,6 +1,7 @@ package org.enso.projectmanager.infrastructure.languageserver -import akka.actor.{Actor, ActorLogging, ActorRef, Props} +import akka.actor.{Actor, ActorRef, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.projectmanager.infrastructure.languageserver.ShutdownHookActivator.ArePendingShutdownHooks import org.enso.projectmanager.infrastructure.languageserver.ShutdownHookActivationWatcher.{ AllShutdownHooksFired, @@ -8,6 +9,7 @@ import org.enso.projectmanager.infrastructure.languageserver.ShutdownHookActivat Watch } import org.enso.projectmanager.util.UnhandledLogging + import scala.concurrent.duration._ /** An actor that waits until all shutdown hooks will be fired. @@ -16,7 +18,7 @@ import scala.concurrent.duration._ */ class ShutdownHookActivationWatcher(shutdownHookActivator: ActorRef) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivator.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivator.scala index 70511598b4..ff281411ff 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivator.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookActivator.scala @@ -2,7 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver import java.util.UUID -import akka.actor.{Actor, ActorLogging, Props} +import akka.actor.{Actor, Props} +import com.typesafe.scalalogging.LazyLogging import org.enso.projectmanager.control.core.CovariantFlatMap import org.enso.projectmanager.control.effect.Exec import org.enso.projectmanager.event.ProjectEvent.ProjectClosed @@ -19,7 +20,7 @@ import org.enso.projectmanager.util.UnhandledLogging */ class ShutdownHookActivator[F[+_, +_]: Exec: CovariantFlatMap] extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def preStart(): Unit = { diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookRunner.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookRunner.scala index 82f501bbca..3fec9bf569 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookRunner.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ShutdownHookRunner.scala @@ -2,8 +2,9 @@ package org.enso.projectmanager.infrastructure.languageserver import java.util.UUID -import akka.actor.{Actor, ActorLogging, Props, Status} +import akka.actor.{Actor, Props, Status} import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.projectmanager.control.core.CovariantFlatMap import org.enso.projectmanager.control.core.syntax._ import org.enso.projectmanager.control.effect.Exec @@ -20,7 +21,7 @@ class ShutdownHookRunner[F[+_, +_]: Exec: CovariantFlatMap]( projectId: UUID, hooks: List[ShutdownHook[F]] ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { import context.dispatcher @@ -30,22 +31,21 @@ class ShutdownHookRunner[F[+_, +_]: Exec: CovariantFlatMap]( } override def receive: Receive = { case Run => - log.info("Firing shutdown hooks for project [{}].", projectId) + logger.info("Firing shutdown hooks for project [{}].", projectId) Exec[F].exec { traverse(hooks) { _.execute() } } pipeTo self context.become(running) } private def running: Receive = { case Status.Failure(th) => - log.error( - th, - "An error occurred during running shutdown hooks for project [{}].", - projectId + logger.error( + s"An error occurred during running shutdown hooks for project [$projectId].", + th ) context.stop(self) case Right(_) => - log.info("All shutdown hooks fired for project [{}].", projectId) + logger.info("All shutdown hooks fired for project [{}].", projectId) context.stop(self) } diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/protocol/ClientController.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/protocol/ClientController.scala index fcde922d78..4d456255bb 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/protocol/ClientController.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/protocol/ClientController.scala @@ -2,7 +2,8 @@ package org.enso.projectmanager.protocol import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash} +import akka.actor.{Actor, ActorRef, Props, Stash} +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{JsonRpcServer, MessageHandler, Method, Request} import org.enso.projectmanager.boot.configuration.TimeoutConfig import org.enso.projectmanager.control.core.CovariantFlatMap @@ -42,7 +43,7 @@ class ClientController[F[+_, +_]: Exec: CovariantFlatMap: ErrorChannel]( loggingServiceDescriptor: LoggingServiceDescriptor, timeoutConfig: TimeoutConfig ) extends Actor - with ActorLogging + with LazyLogging with Stash with UnhandledLogging { @@ -100,7 +101,7 @@ class ClientController[F[+_, +_]: Exec: CovariantFlatMap: ErrorChannel]( override def receive: Receive = { case JsonRpcServer.WebConnect(webActor) => - log.info("Client connected to Project Manager [{}]", clientId) + logger.info("Client connected to Project Manager [{}]", clientId) unstashAll() context.become(connected(webActor)) context.system.eventStream.publish(ClientConnected(clientId)) @@ -110,7 +111,7 @@ class ClientController[F[+_, +_]: Exec: CovariantFlatMap: ErrorChannel]( def connected(@unused webActor: ActorRef): Receive = { case MessageHandler.Disconnected => - log.info("Client disconnected from the Project Manager [{}]", clientId) + logger.info("Client disconnected from the Project Manager [{}]", clientId) context.system.eventStream.publish(ClientDisconnected(clientId)) context.stop(self) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/LoggingServiceEndpointRequestHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/LoggingServiceEndpointRequestHandler.scala index 933cb076c2..f5dbea52ee 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/LoggingServiceEndpointRequestHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/LoggingServiceEndpointRequestHandler.scala @@ -1,8 +1,9 @@ package org.enso.projectmanager.requesthandler -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} import akka.http.scaladsl.model.Uri import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult} import org.enso.projectmanager.protocol.ProjectManagementApi.{ LoggingServiceGetEndpoint, @@ -22,7 +23,7 @@ class LoggingServiceEndpointRequestHandler( loggingServiceDescriptor: LoggingServiceDescriptor, requestTimeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { private def method = LoggingServiceGetEndpoint @@ -51,7 +52,7 @@ class LoggingServiceEndpointRequestHandler( timeoutCancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Failure during {} operation.", method) + logger.error(s"Failure during $method operation.", ex) replyTo ! ResponseError( Some(id), LoggingServiceUnavailable(s"Logging service failed to set up: $ex") @@ -60,7 +61,7 @@ class LoggingServiceEndpointRequestHandler( context.stop(self) case RequestTimeout => - log.error("Request {} with {} timed out.", method, id) + logger.error("Request {} with {} timed out.", method, id) replyTo ! ResponseError( Some(id), LoggingServiceUnavailable( diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectCloseHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectCloseHandler.scala index 2981840c9e..dbcdb99068 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectCloseHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectCloseHandler.scala @@ -2,8 +2,9 @@ package org.enso.projectmanager.requesthandler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.Errors.ServiceError import org.enso.jsonrpc._ import org.enso.projectmanager.control.effect.Exec @@ -28,7 +29,7 @@ class ProjectCloseHandler[F[+_, +_]: Exec]( service: ProjectServiceApi[F], requestTimeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = requestStage @@ -51,18 +52,18 @@ class ProjectCloseHandler[F[+_, +_]: Exec]( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Failure during {} operation.", ProjectClose) + logger.error("Failure during ProjectClose operation.", ex) replyTo ! ResponseError(Some(id), ServiceError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request {} with {} timed out.", ProjectClose, id) + logger.error("Request {} with {} timed out.", ProjectClose, id) replyTo ! ResponseError(Some(id), ServiceError) context.stop(self) case Left(failure: ProjectServiceFailure) => - log.error("Request {} failed due to {}.", id, failure) + logger.error("Request {} failed due to {}.", id, failure) replyTo ! ResponseError(Some(id), mapFailure(failure)) cancellable.cancel() context.stop(self) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectDeleteHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectDeleteHandler.scala index 3bb0d6edd8..76d725561c 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectDeleteHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectDeleteHandler.scala @@ -2,6 +2,7 @@ package org.enso.projectmanager.requesthandler import akka.actor._ import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.Errors.ServiceError import org.enso.jsonrpc._ import org.enso.projectmanager.control.effect.Exec @@ -24,7 +25,7 @@ class ProjectDeleteHandler[F[+_, +_]: Exec]( service: ProjectServiceApi[F], requestTimeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = requestStage @@ -45,18 +46,18 @@ class ProjectDeleteHandler[F[+_, +_]: Exec]( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Failure during {} operation.", ProjectDelete) + logger.error("Failure during ProjectDelete operation.", ex) replyTo ! ResponseError(Some(id), ServiceError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request {} with {} timed out.", ProjectDelete, id) + logger.error("Request {} with {} timed out.", ProjectDelete, id) replyTo ! ResponseError(Some(id), ServiceError) context.stop(self) case Left(failure: ProjectServiceFailure) => - log.error("Request {} failed due to {}.", id, failure) + logger.error("Request {} failed due to {}.", id, failure) replyTo ! ResponseError(Some(id), mapFailure(failure)) cancellable.cancel() context.stop(self) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectListHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectListHandler.scala index d283cb09a1..f5d2577fe9 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectListHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectListHandler.scala @@ -2,8 +2,9 @@ package org.enso.projectmanager.requesthandler import java.util.UUID -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.Errors.ServiceError import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult} import org.enso.projectmanager.control.effect.Exec @@ -30,7 +31,7 @@ class ProjectListHandler[F[+_, +_]: Exec]( service: ProjectServiceApi[F], requestTimeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = requestStage @@ -54,18 +55,18 @@ class ProjectListHandler[F[+_, +_]: Exec]( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Failure during {} operation.", ProjectList) + logger.error("Failure during ProjectList operation.", ex) replyTo ! ResponseError(Some(id), ServiceError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request {} with {} timed out.", ProjectList, id) + logger.error("Request {} with {} timed out.", ProjectList, id) replyTo ! ResponseError(Some(id), ServiceError) context.stop(self) case Left(failure: ProjectServiceFailure) => - log.error("Request {} failed due to {}.", id, failure) + logger.error("Request {} failed due to {}.", id, failure) replyTo ! ResponseError(Some(id), mapFailure(failure)) cancellable.cancel() context.stop(self) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectRenameHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectRenameHandler.scala index 18e1ccea88..da85f79d50 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectRenameHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/ProjectRenameHandler.scala @@ -1,7 +1,8 @@ package org.enso.projectmanager.requesthandler -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Props, Status} import akka.pattern.pipe +import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.Errors.ServiceError import org.enso.jsonrpc._ import org.enso.projectmanager.control.effect.Exec @@ -24,7 +25,7 @@ class ProjectRenameHandler[F[+_, +_]: Exec]( service: ProjectServiceApi[F], requestTimeout: FiniteDuration ) extends Actor - with ActorLogging + with LazyLogging with UnhandledLogging { override def receive: Receive = requestStage @@ -48,18 +49,18 @@ class ProjectRenameHandler[F[+_, +_]: Exec]( cancellable: Cancellable ): Receive = { case Status.Failure(ex) => - log.error(ex, "Failure during {} operation.", ProjectRename) + logger.error("Failure during ProjectRename operation.", ex) replyTo ! ResponseError(Some(id), ServiceError) cancellable.cancel() context.stop(self) case RequestTimeout => - log.error("Request {} with {} timed out.", ProjectRename, id) + logger.error("Request {} with {} timed out.", ProjectRename, id) replyTo ! ResponseError(Some(id), ServiceError) context.stop(self) case Left(failure: ProjectServiceFailure) => - log.error(s"Request {} failed due to {}.", id, failure) + logger.error(s"Request {} failed due to {}.", id, failure) replyTo ! ResponseError(Some(id), mapFailure(failure)) cancellable.cancel() context.stop(self) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/RequestHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/RequestHandler.scala index d1799593e0..6b47488874 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/RequestHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/requesthandler/RequestHandler.scala @@ -1,8 +1,8 @@ package org.enso.projectmanager.requesthandler -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Stash, Status} +import akka.actor.{Actor, ActorRef, Cancellable, Stash, Status} import akka.pattern.pipe -import com.typesafe.scalalogging.Logger +import com.typesafe.scalalogging.{LazyLogging, Logger} import org.enso.jsonrpc.Errors.ServiceError import org.enso.jsonrpc.{ HasParams, @@ -46,7 +46,7 @@ abstract class RequestHandler[ @unused evParams: HasParams.Aux[M, Params], @unused evResult: HasResult.Aux[M, Result] ) extends Actor - with ActorLogging + with LazyLogging with Stash with UnhandledLogging { override def receive: Receive = requestStage @@ -90,18 +90,18 @@ abstract class RequestHandler[ timeoutCancellable: Option[Cancellable] ): Receive = { case Status.Failure(ex) => - log.error(ex, "Failure during {} operation.", method) + logger.error(s"Failure during $method operation.", ex) replyTo ! ResponseError(Some(id), ServiceError) timeoutCancellable.foreach(_.cancel()) context.stop(self) case RequestTimeout => - log.error("Request {} with {} timed out.", method, id) + logger.error("Request {} with {} timed out.", method, id) replyTo ! ResponseError(Some(id), ServiceError) context.stop(self) case Left(failure: FailureType) => - log.error("Request {} with {} failed due to {}.", method, id, failure) + logger.error("Request {} with {} failed due to {}.", method, id, failure) val error = implicitly[FailureMapper[FailureType]].mapFailure(failure) replyTo ! ResponseError(Some(id), error) timeoutCancellable.foreach(_.cancel()) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala index b57eb3e42d..35ff3b5230 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala @@ -1,10 +1,19 @@ package org.enso.projectmanager.util -import akka.actor.{Actor, ActorLogging} +import akka.actor.Actor +import com.typesafe.scalalogging.LazyLogging +import org.enso.loggingservice.LogLevel -trait UnhandledLogging { this: Actor with ActorLogging => +trait UnhandledLogging extends LazyLogging { this: Actor => - override def unhandled(message: Any): Unit = - log.warning("Received unknown message: {}", message) + private val akkaLogLevel = LogLevel + .fromString(context.system.settings.LogLevel) + .getOrElse(LogLevel.Error) + + override def unhandled(message: Any): Unit = { + if (implicitly[Ordering[LogLevel]].lteq(LogLevel.Warning, akkaLogLevel)) { + logger.warn("Received unknown message: {}", message.getClass) + } + } }