white-author-39785
01/13/2023, 3:32 PMcreate
method, I start get a logger with logger = logging.getLogger()
. each of these loggers gets its own configuration with an individual file. However, only one file is created and everything is written there (as if only the last of the logging.getLogger()
instances is really created. This is extremely confusing.
• When using an AuthorizationManagementClient
from azure.mgmt.authorization
, I get really confusing 409 Conflict
responses that make me suspect that a similar thing like with the logger happens here as well.
Could anyone with more experience with dynamic providers give me some insights?echoing-dinner-19531
01/14/2023, 10:33 PMwhite-author-39785
01/16/2023, 8:52 AMechoing-dinner-19531
01/16/2023, 9:14 AMDoes that mean, I can use a dynamic resource provider to create only a single instance of a resource?No. One provider instance can handle multiple resource instances. Have you read the various docs we have on dynamic providers? Might help: https://www.pulumi.com/docs/intro/concepts/resources/dynamic-providers/ https://www.pulumi.com/blog/dynamic-providers/ https://github.com/pulumi/examples/tree/master/aws-py-dynamicresource
white-author-39785
01/16/2023, 9:45 AMechoing-dinner-19531
01/16/2023, 12:27 PMHowever, only one file is created and everything is written there (as if only the last of theSo if that's in the provider "create" call then it will get called multiple times (once for each instance that's created) but the behaviour for getLogger() is to always return the same root logger instance. So that's why your only seeing one file.instances is really created. This is extremely confusing.logging.getLogger()
white-author-39785
01/16/2023, 4:08 PM409
problems were caused by something only existing once that I thought was existing mutliple times: I initialized an ID as uuid.uuid4()
as the default of a function parameter. This is a bad idea as such a code only gets executed once, when defining the function and not each time the function is called.
The logging problems were caused by the fact that the logging.basicConfig
is somehow global.