我有一个应用程序在能够创建actor系统将使用的配置之前需要调用某个外部系统(以解密敏感信息以使其保持简短)。Akka(JVM)在ActorSystem之前初始化记录器
是否可以在我的流程开始时初始化记录器,以便在与外部系统的通信出错时监控/调查工具可以访问日志?
// the following call will modify the config from a secret id read in the conf
// and write the value "redis.password" after getting the value from an Azure Keyvault
val updatedConf = KeyVaultHelper.decryptFromKeyVault(ConfigFactory.load("application"),
Map(
"azure.keyvault.redis.password.secret-id",
"redis.password"
))
// now we initialize the actor system with the updated conf
// and the logging system will be initialized
val system = ActorSystem("ClusterSystem", updatedConf)
你可以发布一些代码示例?真的很难说,因为我认为使用早期初始化器是最悲观的。 –
我刚刚做了,不知道这是否有帮助? – CanardMoussant
因此,您需要在创建系统之前使用记录器。我不确定我是否正确理解你的用例,但我会在下面粘贴一些代码。 –