-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'MultiProcManager' object has no attribute 'logger' #69
Comments
Hi @htarnacki You didn't provide much context, so I apologize if the following does not address your issue: Each Actor is it's own class and not a subclass of the ActorSystem, so to access the logging, you would use the logging globals, or you would need to initialize a logging instance for your actor manually. import logging
class Logger(Actor):
def receiveMessage(self, message, sender):
logging.info(f'Logger: message received: {message}')
self.send(sender, 'Hello, World!') As a minor note, I would recommend you use the older logging.info('Logger: message received: %s', message) The reason I'd recommend this is that the conversion of the arguments to string for for substitution only occurs if the logging message is going to be written (i.e. not filtered out by severity or some other means). This can be a performance benefit by saving numerous calls to various objects' |
Hi @kquick
Based on this statement i thought that there must be some base actor class method for logging purposes which makes this automatic injection of field "actorAddress". I started searching and found:
in class Actor So i tried to run this code:
and it worked exactly as i thought:
but after that i changed actor system implementation from "simpleSystemBase" to "multiprocTCPBase" and the code suddenly stopped working. So i thought it must be a bug:
Good point. Thanks ;-) |
Thanks for the additional information, that is indeed a bug (actually more of an incomplete implementation that wasn't caught before). I will work on getting this supported in a future release; until then, does the method I described in my previous reply work for you? Also, I think you've already seen this, but in case you have not, https://thespianpy.com/doc/using.html#hH-ce55494c-dd7a-4258-a1e8-b090c3bbb1e6 provides additional information about logging configuration. |
Fixed in release 3.10.2. Thanks for the report! |
thespian/actors.py", line 235, in logger
return self._myRef.logger(name)
AttributeError: 'MultiProcManager' object has no attribute 'logger'
thespian-3.10.1
The text was updated successfully, but these errors were encountered: