我有一個應用程序在能夠創建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
因此,您需要在創建系統之前使用記錄器。我不確定我是否正確理解你的用例,但我會在下面粘貼一些代碼。 –