Reduce the number of log INFO events (#10500)

Reducing the number of log events that we spam regular users. Not the last PR in that area, but already a progress.
Also replaced `fileWalk` with a stream approach hoping that maybe it is a bit more stable on Windows.
This commit is contained in:
Hubert Plociniczak 2024-07-17 16:29:48 +02:00 committed by GitHub
parent d1c04fdd30
commit 39898da664
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 223 additions and 197 deletions

View File

@ -24,8 +24,8 @@ public class DirectoriesInitialization extends LockedInitialization {
@Override
public void initComponent() {
logger.info("Initializing directories...");
logger.debug("Initializing directories");
projectDirectoriesConfig.createDirectories();
logger.info("Initialized directories.");
logger.debug("Initialized directories");
}
}

View File

@ -23,8 +23,8 @@ public class JsonRpcInitialization extends LockedInitialization {
@Override
public void initComponent() {
logger.info("Initializing JSON-RPC protocol.");
logger.debug("Initializing JSON-RPC protocol");
protocolFactory.init();
logger.info("JSON-RPC protocol initialized.");
logger.debug("JSON-RPC protocol initialized");
}
}

View File

@ -73,7 +73,7 @@ public class RepoInitialization implements InitializationComponent {
private CompletableFuture<Void> initSuggestionsRepo() {
return CompletableFuture.runAsync(
() -> logger.info("Initializing suggestions repo [{}]...", suggestionsRepo), executor)
() -> logger.debug("Initializing suggestions repo [{}]...", suggestionsRepo), executor)
.thenComposeAsync(
v -> {
if (!isInitialized)
@ -83,12 +83,12 @@ public class RepoInitialization implements InitializationComponent {
},
executor)
.thenRunAsync(
() -> logger.info("Initialized Suggestions repo [{}].", suggestionsRepo), executor)
() -> logger.debug("Initialized Suggestions repo [{}]", suggestionsRepo), executor)
.whenCompleteAsync(
(res, err) -> {
if (err != null) {
logger.error(
"Failed to initialize SQL suggestions repo [{}].", suggestionsRepo, err);
"Failed to initialize SQL suggestions repo [{}]", suggestionsRepo, err);
} else {
eventStream.publish(InitializedEvent.SuggestionsRepoInitialized$.MODULE$);
}
@ -99,9 +99,9 @@ public class RepoInitialization implements InitializationComponent {
return CompletableFuture.runAsync(
() ->
logger.warn(
"Failed to initialize the suggestions database [{}].", suggestionsRepo, error),
"Failed to initialize the suggestions database [{}]", suggestionsRepo, error),
executor)
.thenRunAsync(() -> logger.info("Retrying suggestions repo initialization."), executor)
.thenRunAsync(() -> logger.info("Retrying suggestions repo initialization"), executor)
.thenComposeAsync(v -> doInitSuggestionsRepo(), executor);
}
@ -109,7 +109,7 @@ public class RepoInitialization implements InitializationComponent {
return CompletableFuture.runAsync(
() -> {
if (!isInitialized) {
logger.info("Clear database file. Attempt #{}.", retries + 1);
logger.debug("Clear database file. Attempt #{}", retries + 1);
try {
Files.delete(projectDirectoriesConfig.suggestionsDatabaseFile().toPath());
} catch (IOException e) {
@ -126,14 +126,14 @@ public class RepoInitialization implements InitializationComponent {
return recoverClearDatabaseFile(error.getCause(), retries);
} else if (error instanceof NoSuchFileException) {
logger.warn(
"Failed to delete the database file. Attempt #{}. File does not exist [{}].",
"Failed to delete the database file. Attempt #{}. File does not exist [{}]",
retries + 1,
new MaskedPath(projectDirectoriesConfig.suggestionsDatabaseFile().toPath()));
return CompletableFuture.completedFuture(null);
} else if (error instanceof FileSystemException) {
logger.error(
"Failed to delete the database file. Attempt #{}. The file will be removed during the"
+ " shutdown.",
+ " shutdown",
retries + 1,
error);
Runtime.getRuntime()
@ -143,7 +143,7 @@ public class RepoInitialization implements InitializationComponent {
FileUtils.deleteQuietly(projectDirectoriesConfig.suggestionsDatabaseFile())));
return CompletableFuture.failedFuture(error);
} else if (error instanceof IOException) {
logger.error("Failed to delete the database file. Attempt #{}.", retries + 1, error);
logger.error("Failed to delete the database file. Attempt #{}", retries + 1, error);
if (retries < MAX_RETRIES) {
try {
Thread.sleep(RETRY_DELAY_MILLIS);

View File

@ -43,4 +43,9 @@ public class SequentialResourcesInitialization implements InitializationComponen
return result;
}
@Override
public String toString() {
return "Sequential-initialization of " + resources.length + " resources";
}
}

View File

@ -39,7 +39,7 @@ public class TruffleContextInitialization extends LockedInitialization {
@Override
public void initComponent() {
logger.trace("Creating Runtime context.");
logger.trace("Creating Runtime context");
if (Engine.newBuilder()
.allowExperimentalOptions(true)
.build()
@ -53,10 +53,10 @@ public class TruffleContextInitialization extends LockedInitialization {
}
var truffleContext = truffleContextBuilder.build();
supervisor.registerService(truffleContext);
logger.trace("Created Runtime context [{}].", truffleContext);
logger.info("Initializing Runtime context [{}]...", truffleContext);
logger.trace("Created Runtime context [{}]", truffleContext);
logger.debug("Initializing Runtime context [{}]", truffleContext);
truffleContext.initialize(LanguageInfo.ID);
eventStream.publish(InitializedEvent.TruffleContextInitialized$.MODULE$);
logger.info("Initialized Runtime context [{}].", truffleContext);
logger.debug("Initialized Runtime context [{}]", truffleContext);
}
}

View File

@ -19,7 +19,7 @@ public final class YdocInitialization extends LockedInitialization {
@Override
public void initComponent() {
logger.info("Starting Ydoc server...");
logger.debug("Starting Ydoc server...");
var applicationConfig = ApplicationConfig.load();
var ydoc =
Ydoc.builder()
@ -32,6 +32,6 @@ public final class YdocInitialization extends LockedInitialization {
} catch (Exception e) {
throw new RuntimeException(e);
}
logger.info("Started Ydoc server.");
logger.debug("Started Ydoc server.");
}
}

View File

@ -29,9 +29,9 @@ public class ZioRuntimeInitialization extends LockedInitialization {
@Override
public void initComponent() {
logger.info("Initializing ZIO runtime...");
logger.debug("Initializing ZIO runtime");
runtime.init();
logger.info("ZIO runtime initialized [{}].", runtime);
logger.debug("ZIO runtime initialized");
eventStream.publish(InitializedEvent.ZioRuntimeInitialized$.MODULE$);
}
}

View File

@ -27,7 +27,7 @@ akka {
logging-service {
logger {
akka.actor = info
akka.actor = warn
akka.event = error
akka.routing = error
akka.io = error

View File

@ -43,12 +43,12 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
override def start(): Future[ComponentStarted.type] = {
logger.info("Starting Language Server...")
val sampler = startSampling(config)
logger.debug("Started [{}].", sampler.getClass.getName)
logger.debug("Started [{}]", sampler.getClass.getName)
val module = new MainModule(config, logLevel)
val bindJsonServer =
for {
binding <- module.jsonRpcServer.bind(config.interface, config.rpcPort)
_ <- Future { logger.debug("Json RPC server initialized.") }
_ <- Future { logger.debug("Server for JSON RPC is initialized") }
} yield binding
val bindSecureJsonServer: Future[Option[Http.ServerBinding]] = {
config.secureRpcPort match {
@ -63,7 +63,9 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
val bindBinaryServer =
for {
binding <- module.binaryServer.bind(config.interface, config.dataPort)
_ <- Future { logger.debug("Binary server initialized.") }
_ <- Future {
logger.debug("Server for Binary WebSocket is initialized")
}
} yield binding
val bindSecureBinaryServer: Future[Option[Http.ServerBinding]] = {
@ -96,11 +98,11 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
_ <- Future {
logger.info(
s"Started server at json:${config.interface}:${config.rpcPort}, ${config.secureRpcPort
.map(p => s"secure-jsons:${config.interface}$p")
.getOrElse("")}, " +
.map(p => s"secure-json:${config.interface}$p")
.getOrElse("<secure-json-not-configured>")}, " +
s"binary:${config.interface}:${config.dataPort}${config.secureDataPort
.map(p => s", secure-binary:${config.interface}$p")
.getOrElse("")}"
.getOrElse(", <secure-binary-not-configured>")}"
)
}
} yield ComponentStarted
@ -144,17 +146,17 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
private def releaseResources(serverContext: ServerContext): Future[Unit] =
for {
_ <- Future(serverContext.mainModule.close()).recover(logError)
_ <- Future { logger.info("Terminated main module.") }
_ <- Future { logger.debug("Terminated main module") }
} yield ()
private def terminateAkka(serverContext: ServerContext): Future[Unit] = {
for {
_ <- serverContext.jsonBinding.terminate(2.seconds).recover[Any](logError)
_ <- Future { logger.info("Terminated json connections.") }
_ <- Future { logger.info("Terminated JSON connections") }
_ <- serverContext.binaryBinding
.terminate(2.seconds)
.recover[Any](logError)
_ <- Future { logger.info("Terminated binary connections.") }
_ <- Future { logger.info("Terminated binary connections") }
_ <-
Await
.ready(
@ -162,7 +164,7 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
2.seconds
)
.recover(logError)
_ <- Future { logger.info("Terminated actor system.") }
_ <- Future { logger.debug("Terminated actor system") }
} yield ()
}
@ -174,7 +176,7 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
for {
_ <- killFiber.recover[Any](logError)
_ <- Future { logger.info("Terminated truffle context.") }
_ <- Future { logger.debug("Terminated Truffle context") }
} yield ()
}
@ -186,7 +188,7 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
} yield ComponentRestarted
private val logError: PartialFunction[Throwable, Unit] = { case th =>
logger.error("An error occurred during stopping the server.", th)
logger.error("An error occurred when shutting down the server", th)
}
}

View File

@ -75,7 +75,7 @@ import scala.concurrent.duration.DurationInt
class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
private val log = LoggerFactory.getLogger(this.getClass)
log.info(
log.debug(
"Initializing main module of the Language Server from [{}, {}, {}]",
Info.currentEdition,
serverConfig,
@ -110,7 +110,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
serverConfig.startupConfig,
openAiCfg
)
log.trace("Created Language Server config [{}].", languageServerConfig)
log.trace("Created Language Server config [{}]", languageServerConfig)
implicit val system: ActorSystem =
ActorSystem(
@ -119,31 +119,31 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
Some(getClass.getClassLoader),
Some(serverConfig.computeExecutionContext)
)
log.trace("Created ActorSystem [{}].", system)
log.trace("Created ActorSystem [{}]", system)
private val zioRuntime =
new effect.ExecutionContextRuntime(system.dispatcher)
private val zioExec = effect.ZioExec(zioRuntime)
log.trace("Created ZIO executor [{}].", zioExec)
log.trace("Created ZIO executor [{}]", zioExec)
private val fileSystem: FileSystem = new FileSystem(log)
log.trace("Created file system [{}].", fileSystem)
log.trace("Created file system [{}]", fileSystem)
val git = Git.withEmptyUserConfig(
Some(languageServerConfig.vcsManager.dataDirectory),
languageServerConfig.vcsManager.asyncInit
)
log.trace("Created git [{}].", git)
log.trace("Created git [{}]", git)
implicit val versionCalculator: ContentBasedVersioning =
Sha3_224VersionCalculator
log.trace("Created Version Calculator [{}].", versionCalculator)
log.trace("Created Version Calculator [{}]", versionCalculator)
val suggestionsRepo =
new InMemorySuggestionsRepo()(
system.dispatcher
);
log.trace("Created SQL suggestions repo: [{}].", suggestionsRepo)
log.trace("Created SQL suggestions repo: [{}]", suggestionsRepo)
val idlenessMonitor =
system.actorOf(IdlenessMonitor.props(utcClock))
@ -187,7 +187,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
new NoopEventsMonitor() -> None
}
log.trace(
"Started runtime events monitor [{}].",
"Started runtime events monitor [{}]",
runtimeEventsMonitor.getClass.getName
)
@ -343,7 +343,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
})
system.eventStream.setLogLevel(AkkaConverter.toAkka(logLevel))
log.trace("Set akka log level to [{}].", logLevel)
log.trace("Set akka log level to [{}]", logLevel)
val runtimeKiller =
system.actorOf(
@ -457,7 +457,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
config = languageServerConfig
)
log.trace(
"Created JSON connection controller factory [{}].",
"Created JSON connection controller factory [{}]",
jsonRpcControllerFactory
)
@ -481,7 +481,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
List(healthCheckEndpoint, idlenessEndpoint),
messagesCallback
)
log.trace("Created JSON RPC Server [{}].", jsonRpcServer)
log.trace("Created JSON RPC Server [{}]", jsonRpcServer)
val binaryServer =
new BinaryWebSocketServer(
@ -495,10 +495,10 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
),
messagesCallback
)
log.trace("Created Binary WebSocket Server [{}].", binaryServer)
log.trace("Created Binary WebSocket Server [{}]", binaryServer)
log.info(
"Main module of the Language Server initialized with config [{}].",
log.debug(
"Main module of the Language Server initialized with config [{}]",
languageServerConfig
)
@ -508,7 +508,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
contextSupervisor.close()
runtimeEventsMonitor.close()
ydocSupervisor.close()
log.info("Closed Language Server main module.")
log.info("Stopped Language Server")
}
private def akkaHttpsConfig(): com.typesafe.config.Config = {

View File

@ -92,7 +92,7 @@ final class PathWatcher(
case Success(_) =>
pathToWatchResult.onComplete {
case Success(Right(root)) =>
logger.info(
logger.debug(
"Initialized [{}] for [{}].",
watcherFactory.getClass,
path

View File

@ -84,7 +84,7 @@ final class ReceivesTreeUpdatesHandler(
private def initializing: Receive = {
case InitializedEvent.ZioRuntimeInitialized =>
logger.info("Initialized")
logger.debug("Initialized")
unstashAll()
context.become(withStore(Store()))

View File

@ -194,7 +194,7 @@ class JsonConnectionController(
_,
InitProtocolConnection.Params(clientId)
) =>
logger.info(
logger.debug(
"Initializing resources for [{}] [{}].",
clientId,
mainComponent
@ -219,7 +219,7 @@ class JsonConnectionController(
receiver: ActorRef
): Receive = LoggingReceive {
case _: InitializationComponentInitialized =>
logger.info("RPC session initialized for client [{}].", clientId)
logger.debug("RPC session initialized for client [{}]", clientId)
val session = JsonSession(clientId, self)
context.system.eventStream.publish(JsonSessionInitialized(session))
context.system.eventStream.publish(
@ -337,7 +337,7 @@ class JsonConnectionController(
sender() ! ResponseError(Some(id), SessionAlreadyInitialisedError)
case MessageHandler.Disconnected(_) =>
logger.info("Json session terminated [{}].", rpcSession.clientId)
logger.info("Session terminated [{}].", rpcSession.clientId)
context.system.eventStream.publish(JsonSessionTerminated(rpcSession))
context.stop(self)

View File

@ -30,14 +30,13 @@ final class RuntimeConnector(
with Stash {
override def preStart(): Unit = {
logger.info("Starting the runtime connector.")
logger.debug("Starting the runtime connector")
}
override def receive: Receive = {
case RuntimeConnector.Initialize(engine) =>
logger.info(
s"Runtime connector established connection with the message endpoint [{}].",
engine
logger.debug(
s"Runtime connector established connection with the message endpoint"
)
unstashAll()
context.become(waitingOnEndpoint(engine))
@ -50,7 +49,7 @@ final class RuntimeConnector(
Runtime.Api.Response(None, Api.InitializedNotification())
) =>
logger.debug(
s"Message endpoint [{}] is initialized. Runtime connector can accept messages.",
s"Message endpoint [{}] is initialized. Runtime connector can accept messages",
engine
)
unstashAll()
@ -105,7 +104,7 @@ final class RuntimeConnector(
case None =>
logger.warn(
s"No registered handler found for request " +
s"[${payload.getClass.getCanonicalName}]."
s"[${payload.getClass.getCanonicalName}]"
)
}
@ -120,7 +119,7 @@ final class RuntimeConnector(
sender ! msg
case None =>
logger.warn(
"No sender has been found associated with request id [{}], the response [{}] will be dropped.",
"No sender has been found associated with request id [{}], the response [{}] will be dropped",
correlationId,
payload.getClass.getCanonicalName
)

View File

@ -30,7 +30,7 @@ class RuntimeKiller(
override def receive: Receive = idle()
private def idle(): Receive = { case ShutDownRuntime =>
logger.info("Shutting down the runtime server [{}].", runtimeConnector)
logger.debug("Shutting down the runtime server [{}]", runtimeConnector)
runtimeConnector ! Api.Request(
UUID.randomUUID(),
Api.ShutDownRuntimeServer()
@ -46,7 +46,7 @@ class RuntimeKiller(
cancellable: Cancellable
): Receive = {
case ResourceDisposalTimeout =>
logger.error("Disposal of runtime resources timed out.")
logger.error("Disposal of runtime resources timed out")
shutDownTruffle(replyTo)
case Api.Response(_, Api.RuntimeServerShutDown()) =>
@ -63,8 +63,8 @@ class RuntimeKiller(
private def shutDownTruffle(replyTo: ActorRef, retryCount: Int = 0): Unit = {
try {
logger.info(
"Shutting down the Truffle context. Attempt #{}.",
logger.debug(
"Shutting down the Truffle context. Attempt #{}",
retryCount + 1
)
truffleContextSupervisor.close()

View File

@ -92,8 +92,8 @@ final class SuggestionsHandler(
import SuggestionsHandler._
override def preStart(): Unit = {
logger.info(
"Starting suggestions handler from [{}, {}].",
logger.debug(
"Starting suggestions handler from [{}, {}]",
config,
suggestionsRepo
)
@ -121,12 +121,12 @@ final class SuggestionsHandler(
private def initializing(init: SuggestionsHandler.Initialization): Receive = {
case ProjectNameUpdated(name, updates) =>
logger.info("Initializing: project name is updated to [{}].", name)
logger.debug("Initializing: project name is updated to [{}]", name)
updates.foreach(sessionRouter ! _)
tryInitialize(init.copy(project = Some(name)))
case InitializedEvent.SuggestionsRepoInitialized =>
logger.info("Initializing: suggestions repo initialized.")
logger.debug("Initializing: suggestions repo initialized")
tryInitialize(
init.copy(suggestions =
Some(InitializedEvent.SuggestionsRepoInitialized)
@ -134,13 +134,13 @@ final class SuggestionsHandler(
)
case InitializedEvent.TruffleContextInitialized =>
logger.info("Initializing: Truffle context initialized.")
logger.debug("Initializing: Truffle context initialized")
PackageManager.Default
.loadPackage(config.projectContentRoot.file)
.fold(
t =>
logger.error(
"Cannot read the package definition from [{}].",
"Cannot read the package definition from [{}]",
MaskedPath(config.projectContentRoot.file.toPath),
t
),
@ -150,11 +150,11 @@ final class SuggestionsHandler(
runtimeConnector ! Api.Request(requestId, Api.GetTypeGraphRequest())
case Api.Response(_, Api.GetTypeGraphResponse(g)) =>
logger.info("Initializing: got type graph response.")
logger.trace("Initializing: got type graph response")
tryInitialize(init.copy(typeGraph = Some(g)))
case Status.Failure(ex) =>
logger.error("Initialization failure.", ex)
logger.error("Initialization failure", ex)
case _ => stash()
}
@ -186,7 +186,7 @@ final class SuggestionsHandler(
case msg: Api.SuggestionsDatabaseSuggestionsLoadedNotification
if state.isSuggestionLoadingRunning =>
logger.trace(
"SuggestionsDatabaseSuggestionsLoadedNotification [shouldStartBackgroundProcessing={}].",
"SuggestionsDatabaseSuggestionsLoadedNotification [shouldStartBackgroundProcessing={}]",
state.shouldStartBackgroundProcessing
)
if (state.shouldStartBackgroundProcessing) {
@ -197,7 +197,7 @@ final class SuggestionsHandler(
case msg: Api.SuggestionsDatabaseSuggestionsLoadedNotification =>
logger.debug(
"Starting loading suggestions for library [{}].",
"Starting loading suggestions for library [{}]",
msg.libraryName
)
context.become(
@ -224,7 +224,7 @@ final class SuggestionsHandler(
self ! SuggestionsHandler.SuggestionLoadingCompleted
case Failure(ex) =>
logger.error(
"Error applying suggestion updates for loaded library [{}].",
"Error applying suggestion updates for loaded library [{}]",
msg.libraryName,
ex
)
@ -240,7 +240,7 @@ final class SuggestionsHandler(
applyDatabaseUpdates(msg)
.onComplete {
case Success(notification) =>
logger.debug("Complete module update [{}].", msg.module)
logger.debug("Complete module update [{}]", msg.module)
if (notification.updates.nonEmpty) {
clients.foreach { clientId =>
sessionRouter ! DeliverToJsonController(clientId, notification)
@ -249,7 +249,7 @@ final class SuggestionsHandler(
self ! SuggestionsHandler.SuggestionUpdatesCompleted
case Failure(ex) =>
logger.error(
"Error applying suggestion database updates [{}].",
"Error applying suggestion database updates [{}]",
msg.module,
ex
)
@ -269,7 +269,7 @@ final class SuggestionsHandler(
case Api.ExpressionUpdates(_, updates) =>
logger.debug(
"Received expression updates [{}].",
"Received expression updates [{}]",
updates.map(u => (u.expressionId, u.expressionType))
)
val types = updates.toSeq
@ -297,7 +297,7 @@ final class SuggestionsHandler(
self ! SuggestionsHandler.SuggestionUpdatesCompleted
case Failure(ex) =>
logger.error(
"Error applying changes from computed values [{}].",
"Error applying changes from computed values [{}]",
updates.map(_.expressionId),
ex
)
@ -343,7 +343,7 @@ final class SuggestionsHandler(
_ <- suggestionsRepo.clean
} yield {
logger.trace(
"ClearSuggestionsDatabase [{}].",
"ClearSuggestionsDatabase [{}]",
state.suggestionLoadingQueue
)
state.suggestionLoadingQueue.clear()
@ -400,12 +400,12 @@ final class SuggestionsHandler(
}
case Success(Left(err)) =>
logger.error(
s"Error cleaning the index after file delete event [{}].",
s"Error cleaning the index after file delete event [{}]",
err
)
case Failure(ex) =>
logger.error(
"Error cleaning the index after file delete event.",
"Error cleaning the index after file delete event",
ex
)
}
@ -473,7 +473,7 @@ final class SuggestionsHandler(
logger.debug("Trying to initialize with state [{}]", state)
state.initialized.fold(context.become(initializing(state))) {
case (projectName, graph) =>
logger.debug("Initialized with state [{}].", state)
logger.debug("Initialized with state [{}]", state)
context.become(initialized(projectName, graph, Set(), new State()))
unstashAll()
}
@ -527,7 +527,7 @@ final class SuggestionsHandler(
action match {
case Api.SuggestionAction.Add() =>
if (ids.isEmpty) {
logger.error("Cannot {} [{}].", verb, suggestion)
logger.error("Cannot {} [{}]", verb, suggestion)
}
ids.map(
SuggestionsDatabaseUpdate.Add(
@ -537,7 +537,7 @@ final class SuggestionsHandler(
)
case Api.SuggestionAction.Remove() =>
if (ids.isEmpty) {
logger.error(s"Cannot {} [{}].", verb, suggestion)
logger.error(s"Cannot {} [{}]", verb, suggestion)
}
ids.map(id => SuggestionsDatabaseUpdate.Remove(id))
case m: Api.SuggestionAction.Modify =>

View File

@ -71,7 +71,7 @@ class CollaborativeBuffer(
private def uninitialized: Receive = {
case OpenFile(client, path) =>
context.system.eventStream.publish(BufferOpened(path))
logger.info(
logger.debug(
"Buffer opened for [path:{}, client:{}].",
path,
client.clientId
@ -80,7 +80,7 @@ class CollaborativeBuffer(
case OpenBuffer(client, path) =>
context.system.eventStream.publish(BufferOpened(path))
logger.info(
logger.debug(
"Buffer opened in-memory for [path:{}, client:{}].",
path,
client.clientId

View File

@ -47,8 +47,9 @@ public class SetExecutionEnvironmentCommand extends AsynchronousCommand {
ctx.locking().getOrCreateContextLock(contextId),
this.getClass(),
() -> {
var oldEnvironment = ctx.executionService().getContext().getExecutionEnvironment();
if (!oldEnvironment.getName().equals(executionEnvironment.name())) {
var oldEnvironmentName =
ctx.executionService().getContext().getExecutionEnvironment().getName();
if (!oldEnvironmentName.equals(executionEnvironment.name())) {
ctx.jobControlPlane().abortJobs(contextId);
ctx.locking()
.withWriteCompilationLock(
@ -66,8 +67,10 @@ public class SetExecutionEnvironmentCommand extends AsynchronousCommand {
});
} else {
logger.log(
Level.FINEST,
"Requested environment is the same as the current one. Request has no effect");
Level.FINE,
"Requested environment '{}' is the same as the current one. Request has no"
+ " effect",
oldEnvironmentName);
reply(new Runtime$Api$SetExecutionEnvironmentResponse(contextId), ctx);
}
return null;

View File

@ -24,6 +24,11 @@ public final class ModuleIndexing {
assert isIndexed;
return new IndexState(true, ir);
}
@Override
public String toString() {
return "IndexState(" + isIndexed + ", " + ir.getClass() + ")";
}
}
private final ConcurrentMap<Module, IndexState> modules;

View File

@ -61,7 +61,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
}
}
private def acquireWriteCompilationLock(): Long = {
private def acquireWriteCompilationLock(where: Class[_]): Long = {
assertNotLocked(
compilationLock,
true,
@ -72,7 +72,10 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
s"Cannot acquire compilation write lock when having pending edits lock"
)
assertNoFileLock("Cannot acquire write compilation lock")
logLockAcquisition(compilationLock.writeLock(), "write compilation")
logLockAcquisition(
compilationLock.writeLock(),
"write compilation for " + where.getSimpleName
)
}
private def releaseWriteCompilationLock(): Unit =
@ -87,7 +90,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
def withWriteCompilationLock[T](where: Class[_], callable: Callable[T]): T = {
var lockTimestamp: Long = 0
try {
lockTimestamp = acquireWriteCompilationLock();
lockTimestamp = acquireWriteCompilationLock(where);
callable.call();
} catch {
case ie: InterruptedException =>
@ -98,7 +101,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
releaseWriteCompilationLock()
logger.log(
Level.FINEST,
s"Kept write compilation lock [{0}] for {1} milliseconds",
s"Kept write compilation lock [{0}] for {1}ms",
Array[Any](
where.getSimpleName,
System.currentTimeMillis - lockTimestamp
@ -108,7 +111,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
}
}
private def acquireReadCompilationLock(): Long = {
private def acquireReadCompilationLock(where: Class[_]): Long = {
// CloseFileCmd does:
// ctx.locking.acquireReadCompilationLock()
// ctx.locking.acquireFileLock(request.path)
@ -119,7 +122,10 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
pendingEditsLock,
s"Cannot acquire compilation read lock when having pending edits lock"
)
logLockAcquisition(compilationLock.readLock(), "read compilation")
logLockAcquisition(
compilationLock.readLock(),
"read compilation for " + where.getSimpleName
)
}
private def releaseReadCompilationLock(): Unit =
@ -128,7 +134,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
def withReadCompilationLock[T](where: Class[_], callable: Callable[T]): T = {
var lockTimestamp: Long = 0
try {
lockTimestamp = acquireReadCompilationLock();
lockTimestamp = acquireReadCompilationLock(where);
callable.call();
} catch {
case ie: InterruptedException =>
@ -139,7 +145,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
releaseReadCompilationLock()
logger.log(
Level.FINEST,
s"Kept read compilation lock [{0}] for {1} milliseconds",
s"Kept read compilation lock [{0}] for {1}ms",
Array[Any](
where.getSimpleName,
System.currentTimeMillis - lockTimestamp
@ -174,7 +180,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
releasePendingEditsLock()
logger.log(
Level.FINEST,
s"Kept pending edits lock [{0}] for {1} milliseconds",
s"Kept pending edits lock [{0}] for {1}ms",
Array[Any](
where.getSimpleName,
System.currentTimeMillis - lockTimestamp
@ -207,7 +213,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
contextLock.lock.unlock()
logger.log(
Level.FINEST,
s"Kept context lock [{0}] for {1} milliseconds",
s"Kept context lock [{0}] for {1}ms",
Array[Any](
where.getSimpleName,
System.currentTimeMillis - contextLockTimestamp
@ -265,7 +271,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
releaseFileLock(file)
logger.log(
Level.FINEST,
s"Kept file lock [{0}] for {1} milliseconds",
s"Kept file lock [{0}] for {1}ms",
Array[Any](
where.getSimpleName,
System.currentTimeMillis - lockTimestamp
@ -279,7 +285,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
val now = System.currentTimeMillis()
lock.lockInterruptibly()
val now2 = System.currentTimeMillis()
logger.log(Level.FINEST, s"Waited ${now2 - now} for the $msg lock")
logger.log(Level.FINEST, s"Waited ${now2 - now}ms for the $msg lock")
now2
}

View File

@ -25,7 +25,7 @@ object StartBackgroundProcessingJob {
val jobsStarted = ctx.jobControlPlane.startBackgroundJobs()
if (jobsStarted) {
ctx.executionService.getLogger
.log(Level.INFO, "Background jobs started.")
.log(Level.FINE, "Background jobs started")
ctx.endpoint.sendToClient(
Api.Response(Api.BackgroundJobsStartedNotification())
)

View File

@ -299,7 +299,7 @@ public final class Cache<T, M> {
} else {
logger.log(
logLevel,
Level.FINE,
"Could not load the cache metadata at ["
+ toMaskedPath(metadataPath).applyMasking()
+ "].");

View File

@ -45,7 +45,7 @@ public final class SuggestionsCache
LibraryName libraryName) {
var impl = new SuggestionsCache(libraryName);
var logName = "Suggestions(" + libraryName + ")";
return Cache.create(impl, Level.INFO, logName, true, false);
return Cache.create(impl, Level.FINE, logName, true, false);
}
@Override

View File

@ -2,19 +2,19 @@ package org.enso.test.utils;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Comparator;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.enso.pkg.QualifiedName;
import org.enso.polyglot.PolyglotContext;
import org.enso.polyglot.RuntimeOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Context.Builder;
import org.graalvm.polyglot.Value;
import org.slf4j.LoggerFactory;
/** Utility methods for creating and running Enso projects. */
public class ProjectUtils {
@ -121,21 +121,19 @@ prefer-local-libraries: true
/** Deletes provided directory recursively. */
public static void deleteRecursively(Path rootDir) throws IOException {
Files.walkFileTree(
rootDir,
new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
var deletedFiles =
Files.walk(rootDir)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.map(f -> new FileDeletion(f.getPath(), f.delete()))
.filter(d -> !d.deleted())
.collect(Collectors.toList());
if (rootDir.toFile().exists()) {
var logger = LoggerFactory.getLogger(ProjectUtils.class);
logger.error("{} root directory failed to delete because of the following path(s):", rootDir);
deletedFiles.forEach(d -> logger.error(" - {}", d.filePath()));
}
}
record FileDeletion(String filePath, boolean deleted) {}
}

View File

@ -146,7 +146,7 @@ class DefaultLocalLibraryProvider(searchPaths: List[Path])
// Only one warning at warning level is emitted.
logger.trace(warning)
} else {
logger.warn(warning)
logger.debug(warning)
alreadyWarned.put(path, suffix)
}
}

View File

@ -21,7 +21,10 @@ logging-service {
akka.http = warn
akka.stream = error
akka.routing = error
java.lang.Runtime = warn
jdk.event.security = warn
ch.qos.logback.classic.net.SimpleSocketServer = error
ch.qos.logback.classic.net.SocketNode = error
}
appenders = [
{

View File

@ -53,7 +53,7 @@ class LanguageServerBootLoader(
import context.dispatcher
override def preStart(): Unit = {
logger.info("Booting a language server [{}].", descriptor)
logger.debug("Booting a language server [{}]", descriptor)
self ! FindFreeSocket
}
@ -82,9 +82,9 @@ class LanguageServerBootLoader(
secureBinaryPort =
Some(findPort(regularPorts + secureJsonRpcPort.get))
}
logger.info(
logger.debug(
"Found sockets for the language server " +
"[json:{}:{}:{}, binary:{}:{}:{}].",
"[json:{}:{}:{}, binary:{}:{}:{}]",
descriptor.networkConfig.interface,
jsonRpcPort,
secureJsonRpcPort.getOrElse("none"),
@ -189,7 +189,7 @@ class LanguageServerBootLoader(
dataPort = dataPort,
secureDataPort = secureDataPort
)
logger.info("Language server booted [{}].", connectionInfo)
logger.debug("Language server booted [{}]", connectionInfo)
bootRequester ! ServerBooted(connectionInfo, self)
context.become(running(connectionInfo))

View File

@ -127,7 +127,7 @@ class LanguageServerController(
private def booting(Bootloader: ActorRef): Receive =
LoggingReceive.withLabel("booting") {
case BootTimeout =>
logger.error("Booting failed for {}.", descriptor)
logger.error("Booting failed for {}", descriptor)
unstashAll()
context.become(bootFailed(LanguageServerProtocol.ServerBootTimedOut))
@ -151,12 +151,12 @@ class LanguageServerController(
)
case Terminated(Bootloader) =>
logger.error("Bootloader for project {} failed.", project.name)
logger.error("Bootloader for project {} failed", project.name)
unstashAll()
context.become(
bootFailed(
LanguageServerProtocol.ServerBootFailed(
new Exception("The number of boot retries exceeded.")
new Exception("The number of boot retries exceeded")
)
)
)
@ -187,7 +187,7 @@ class LanguageServerController(
s"Requested to boot a server version $requestedEngineVersion, " +
s"but a server for this project with a different version, " +
s"$engineVersion, is already running. Two servers with different " +
s"versions cannot be running for a single project."
s"versions cannot be running for a single project"
)
)
} else {
@ -214,7 +214,7 @@ class LanguageServerController(
}
case Terminated(_) =>
scheduledShutdown.foreach(_._1.cancel())
logger.debug("Bootloader for {} terminated.", project)
logger.debug("Bootloader for {} terminated", project)
case StopServer(clientId, _) =>
removeClient(
@ -284,7 +284,7 @@ class LanguageServerController(
case ServerDied =>
scheduledShutdown.foreach(_._1.cancel())
logger.error("Language server died [{}].", connectionInfo)
logger.error("Language server died [{}]", connectionInfo)
context.stop(self)
}
@ -302,7 +302,7 @@ class LanguageServerController(
val updatedClients = clients - clientId
if (updatedClients.isEmpty) {
if (!explicitShutdownRequested) {
logger.debug("Delaying shutdown for project {}.", project.id)
logger.debug("Delaying shutdown for project {}", project.id)
val scheduledShutdown: Option[(Cancellable, Int)] =
shutdownTimeout.orElse(
Some(
@ -342,7 +342,7 @@ class LanguageServerController(
}
private def shutDownServer(maybeRequester: Option[ActorRef]): Unit = {
logger.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
@ -364,10 +364,10 @@ class LanguageServerController(
case LanguageServerProcess.ServerTerminated(exitCode) =>
cancellable.cancel()
if (exitCode == 0) {
logger.info("Language server shut down successfully [{}].", project)
logger.debug("Language server shut down successfully [{}]", project)
} else {
logger.warn(
"Language server shut down with non-zero exit code: {} [{}].",
"Language server shut down with non-zero exit code: {} [{}]",
exitCode,
project
)
@ -376,17 +376,17 @@ class LanguageServerController(
stop()
case ShutdownTimeout =>
logger.error("Language server shutdown timed out.")
logger.error("Language server shutdown timed out")
maybeRequester.foreach(_ ! ServerShutdownTimedOut)
stop()
case ClientDisconnected(clientId, _) =>
logger.debug(
s"Received client ($clientId) disconnect request during shutdown. Ignoring."
s"Received client ($clientId) disconnect request during shutdown. Ignoring"
)
case ShutDownServer =>
logger.debug(s"Received shutdown request during shutdown. Ignoring.")
logger.debug(s"Received shutdown request during shutdown. Ignoring")
case m: StartServer =>
// This instance has not yet been shut down. Retry

View File

@ -50,11 +50,11 @@ class ShutdownHookActivator[F[+_, +_]: Exec: CovariantFlatMap]
context.become(running(hooks - projectId, projectId :: scheduled))
} else if (scheduled.contains(projectId)) {
logger.debug(
s"Request for starting shutdown hooks has already been filed for project ${projectId}. Ignoring."
s"Request for starting shutdown hooks has already been filed for project ${projectId}. Ignoring"
)
} else {
logger.warn(
s"Shutdown hook activator has no recollection of project ${projectId}. Either it was closed already or it never existed. Ignoring."
s"Shutdown hook activator has no recollection of project ${projectId}. Either it was closed already or it never existed. Ignoring"
)
}

View File

@ -181,7 +181,7 @@ class EngineManagementApiSpec
val message =
"Installation has been cancelled by the user because the requested " +
"engine release is marked as broken."
"engine release is marked as broken"
client.expectJson(json"""
{
"jsonrpc":"2.0",

View File

@ -38,4 +38,5 @@ trait RuntimeVersionManagementUserInterface
/** Called to allow for special handling of info-level logs. */
def logInfo(message: => String): Unit
}

View File

@ -84,7 +84,7 @@ class RuntimeVersionManager(
s"loaded due to $e. Until the launcher gets an auto-repair " +
s"feature, please try reinstalling the runtime by " +
s"uninstalling all engines that use it and installing them " +
s"again, or manually removing `$path`.",
s"again, or manually removing `$path`",
e
)
)
@ -93,9 +93,9 @@ class RuntimeVersionManager(
}
graalRuntimeOpt match {
case Some(graalRuntime) =>
logger.info("Found GraalVM runtime [{}].", graalRuntime)
logger.debug("Found GraalVM runtime [{}]", graalRuntime)
case None =>
logger.info("GraalVM runtime [{}] not found.", version)
logger.debug("GraalVM runtime [{}] not found", version)
}
graalRuntimeOpt
}
@ -128,7 +128,7 @@ class RuntimeVersionManager(
Failure(
ComponentMissingError(
"The engine has been removed before the command could be " +
"started.",
"started",
error
)
)
@ -163,7 +163,7 @@ class RuntimeVersionManager(
Failure(
ComponentMissingError(
"The engine has been removed before the command could be " +
"started.",
"started",
error
)
)
@ -176,7 +176,7 @@ class RuntimeVersionManager(
Failure(
ComponentMissingError(
"The runtime has been removed before the command could be " +
"started.",
"started",
error
)
)
@ -207,7 +207,7 @@ class RuntimeVersionManager(
}
} else {
throw ComponentMissingError(
s"No runtime for engine $engine. Cannot continue."
s"No runtime for engine $engine. Cannot continue"
)
}
}
@ -253,7 +253,7 @@ class RuntimeVersionManager(
if (engine.isMarkedBroken) {
logger.warn(
"Running an engine release [{}] that is marked as broken. " +
"Please consider upgrading to a stable release.",
"Please consider upgrading to a stable release",
version
)
}
@ -270,7 +270,7 @@ class RuntimeVersionManager(
s"loaded due to $e " +
s"Please try reinstalling by running " +
s"`enso uninstall engine $version` followed by " +
s"`enso install engine $version`.",
s"`enso install engine $version`",
e
)
)
@ -285,7 +285,7 @@ class RuntimeVersionManager(
def findOrInstallEngine(version: SemVer): Engine =
findEngine(version) match {
case Some(found) =>
logger.info("The engine [{}] found.", version)
logger.debug("The engine [{}] found", version)
found
case None =>
if (userInterface.shouldInstallMissingEngine(version)) {
@ -298,17 +298,17 @@ class RuntimeVersionManager(
case Some(engine) =>
val message =
s"The engine $version has already been installed by a " +
s"different process."
logger.info(message)
s"different process"
logger.debug(message)
userInterface.logInfo(message)
engine
case None =>
logger.info("The engine [{}] not found.", version)
logger.debug("The engine [{}] not found", version)
installEngine(version)
}
}
} else {
throw ComponentMissingError(s"No engine $version. Cannot continue.")
throw ComponentMissingError(s"No engine $version. Cannot continue")
}
}
@ -391,19 +391,19 @@ class RuntimeVersionManager(
Resources.Engine(version) -> LockType.Exclusive
) {
val engine = getEngine(version).getOrElse {
logger.warn("Enso Engine [{}] is not installed.", version)
throw ComponentMissingError(s"Enso Engine $version is not installed.")
logger.warn("Enso Engine [{}] is not installed", version)
throw ComponentMissingError(s"Enso Engine $version is not installed")
}
if (!Files.isWritable(engine.path)) {
val message =
s"$engine cannot be uninstalled because it is placed in a " +
s"read-only location (bundled versions cannot be uninstalled)."
s"read-only location (bundled versions cannot be uninstalled)"
logger.error(message)
throw UninstallationError(message)
}
safelyRemoveComponent(engine.path)
userInterface.logInfo(s"Uninstalled $engine.")
userInterface.logInfo(s"Uninstalled $engine")
internalCleanupGraalRuntimes()
}
@ -439,7 +439,7 @@ class RuntimeVersionManager(
logger.warn(
"Ignoring the minimum required engine version check " +
s"[${manifest.minimumRequiredVersion}] for the development version " +
s"[${CurrentVersion.version}]."
s"[${CurrentVersion.version}]"
)
true
} else {
@ -462,7 +462,7 @@ class RuntimeVersionManager(
* [[Resources.Runtime]], but it is released before it returns.
*/
private def installEngine(version: SemVer): Engine = {
logger.info("Installing the engine [{}].", version)
logger.info("Installing the engine [{}]", version)
val engineRelease = engineReleaseProvider.fetchRelease(version).get
val isCompatible = isEngineVersionCompatibleWithThisInstaller(
engineRelease.manifest
@ -478,12 +478,12 @@ class RuntimeVersionManager(
if (!continue) {
throw BrokenComponentError(
"Installation has been cancelled by the user because the " +
"requested engine release is marked as broken."
"requested engine release is marked as broken"
)
}
}
FileSystem.withTemporaryDirectory("enso-install") { globalTmpDirectory =>
logger.debug("Downloading packages to [{}].", globalTmpDirectory)
logger.debug("Downloading packages to [{}]", globalTmpDirectory)
val enginePackage = globalTmpDirectory / engineRelease.packageFileName
val downloadTask = engineRelease.downloadPackage(enginePackage)
userInterface.trackProgress(
@ -504,7 +504,7 @@ class RuntimeVersionManager(
localTmpDirectory,
Some(engineDirectoryName)
)
userInterface.trackProgress("Extracting the engine.", extractionTask)
userInterface.trackProgress("Extracting the engine", extractionTask)
extractionTask.force()
val engineTemporaryPath = localTmpDirectory / engineDirectoryName
@ -531,7 +531,7 @@ class RuntimeVersionManager(
undoTemporaryEngine()
throw InstallationError(
"Cannot add the broken mark to the installed engine's " +
"manifest. The installation has failed.",
"manifest. The installation has failed",
ex
)
}
@ -540,7 +540,7 @@ class RuntimeVersionManager(
val temporaryEngine = loadEngine(engineTemporaryPath).getOrElse {
undoTemporaryEngine()
throw InstallationError(
"Cannot load downloaded engine. Installation reverted."
"Cannot load downloaded engine. Installation reverted"
)
}
@ -552,7 +552,7 @@ class RuntimeVersionManager(
throw InstallationError(
"Manifest of installed engine does not match the published " +
"manifest. This may lead to version inconsistencies; the package " +
"may possibly be corrupted. Reverting installation."
"may possibly be corrupted. Reverting installation"
)
}
@ -572,7 +572,7 @@ class RuntimeVersionManager(
val engine = getEngine(version).getOrElse {
logger.error(
"fatal: Could not load the installed engine." +
"Reverting the installation."
"Reverting the installation"
)
FileSystem.removeDirectory(enginePath)
if (wasJustInstalled && findEnginesUsingRuntime(runtime).isEmpty) {
@ -584,7 +584,7 @@ class RuntimeVersionManager(
)
}
userInterface.logInfo(s"Installed $engine.")
userInterface.logInfo(s"Installed $engine")
engine
}
@ -644,7 +644,7 @@ class RuntimeVersionManager(
/** Loads the GraalVM runtime definition.
*/
private def loadGraalRuntime(path: Path): Try[GraalRuntime] = {
logger.debug("Loading Graal runtime [{}].", path)
logger.debug("Loading Graal runtime [{}]", path)
val name = path.getFileName.toString
for {
version <- parseGraalRuntimeVersionString(name)
@ -678,7 +678,7 @@ class RuntimeVersionManager(
case OS.MacOS => msg
case OS.Windows =>
if (msg.contains("-1073741515")) {
"Required Microsoft Visual C++ installation is missing."
"Required Microsoft Visual C++ installation is missing"
} else {
msg
}
@ -696,7 +696,7 @@ class RuntimeVersionManager(
Some(GraalVMVersion(graalVersionString, javaVersionString))
case _ =>
logger.warn(
s"Unrecognized runtime name `$name`."
s"Unrecognized runtime name `$name`"
)
None
}
@ -721,7 +721,7 @@ class RuntimeVersionManager(
.recoverWith(_ =>
Failure(
UnrecognizedComponentError(
s"Invalid engine component version `$name`."
s"Invalid engine component version `$name`"
)
)
)
@ -763,14 +763,14 @@ class RuntimeVersionManager(
runtimeVersion: GraalVMVersion
): GraalRuntime =
FileSystem.withTemporaryDirectory("enso-install-runtime") { directory =>
logger.info("Installing GraalVM runtime [{}].", runtimeVersion)
logger.debug("Installing GraalVM runtime [{}]", runtimeVersion)
val runtimePackage =
directory / runtimeReleaseProvider.packageFileName(runtimeVersion)
val downloadTask =
runtimeReleaseProvider.downloadPackage(runtimeVersion, runtimePackage)
logger.debug("Downloading [{}].", runtimePackage.getFileName)
logger.debug("Downloading [{}]", runtimePackage.getFileName)
userInterface.trackProgress(
s"Downloading ${runtimePackage.getFileName}.",
s"Downloading ${runtimePackage.getFileName}",
downloadTask
)
downloadTask.force()
@ -786,8 +786,8 @@ class RuntimeVersionManager(
localTmpDirectory,
Some(runtimeDirectoryName)
)
logger.debug("Extracting [{}].", runtimePackage)
userInterface.trackProgress("Extracting the runtime.", extractionTask)
logger.debug("Extracting [{}]", runtimePackage)
userInterface.trackProgress("Extracting the runtime", extractionTask)
extractionTask.force()
val runtimeTemporaryPath = localTmpDirectory / runtimeDirectoryName
@ -799,23 +799,23 @@ class RuntimeVersionManager(
}
try {
logger.debug("Loading temporary runtime [{}].", runtimeTemporaryPath)
logger.debug("Loading temporary runtime [{}]", runtimeTemporaryPath)
val temporaryRuntime =
loadGraalRuntime(runtimeTemporaryPath).recoverWith { error =>
Failure(
InstallationError(
"Cannot load the installed runtime. The package may have " +
"been corrupted. Reverting installation.",
"been corrupted. Reverting installation",
error
)
)
}.get
logger.debug("Installing GraalVM components to [{}].", temporaryRuntime)
logger.debug("Installing GraalVM components to [{}]", temporaryRuntime)
installRequiredRuntimeComponents(temporaryRuntime).recoverWith {
error =>
Failure(
InstallationError(
"fatal: Cannot install the required runtime components.",
"fatal: Cannot install the required runtime components",
error
)
)
@ -824,7 +824,7 @@ class RuntimeVersionManager(
val runtimePath =
distributionManager.paths.runtimes / runtimeDirectoryName
logger.debug(
"Moving [{}] to [{}].",
"Moving [{}] to [{}]",
runtimeTemporaryPath,
runtimePath
)
@ -833,13 +833,13 @@ class RuntimeVersionManager(
FileSystem.removeDirectory(runtimePath)
Failure(
InstallationError(
"fatal: Cannot load the installed runtime.",
"fatal: Cannot load the installed runtime",
error
)
)
}.get
logger.debug("Installed [{}].", runtime)
userInterface.logInfo(s"Installed $runtime.")
logger.debug("Installed [{}]", runtime)
userInterface.logInfo(s"Installed $runtime")
runtime
} catch {
@ -856,7 +856,7 @@ class RuntimeVersionManager(
private def installRequiredRuntimeComponents(
runtime: GraalRuntime
): Try[Unit] = {
logger.debug("Installing GraalVM components [{}, {}].", runtime, os)
logger.debug("Installing GraalVM components [{}, {}]", runtime, os)
val cu = componentUpdaterFactory.build(runtime)
val requiredComponents =
componentConfig.getRequiredComponents(runtime.version, os)
@ -866,7 +866,7 @@ class RuntimeVersionManager(
for {
installedComponents <- cu.list()
_ = logger.debug(
"Available GraalVM components: [{}].",
"Available GraalVM components: [{}]",
installedComponents
)
missingComponents = requiredComponents.diff(installedComponents)
@ -890,14 +890,14 @@ class RuntimeVersionManager(
if (findEnginesUsingRuntime(runtime).isEmpty) {
userInterface.logInfo(
s"Removing $runtime, because it is not used by any installed Enso " +
s"versions."
s"versions"
)
if (Files.isWritable(runtime.path)) {
safelyRemoveComponent(runtime.path)
} else {
logger.warn(
"{} cannot be uninstalled because it is placed in a " +
"read-only location.",
"read-only location",
runtime
)
}

View File

@ -353,4 +353,8 @@ class InMemorySuggestionsRepo(implicit ec: ExecutionContext)
}
def close(): Unit = {}
override def toString(): String = {
"InMemorySuggestionsRepo"
}
}