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
Logger and persistence problem #42
Comments
Hi @BasvanH The logger is persisted along with the model data - this is done so that it continues logging after being reconstituted from storage Unfortunately, however, there is a language-wide restriction that anonymous classes (as well as anonymous functions) cannot be deserialized (see this page). If you think about it, there is no way for the program to know what to do with the instance data if it cannot attach it to a class definition. If you want to be able to persist the logger along with the rest of the model data, then just turn it into a regular class and it should work fine. Since we use the PSR-3 logging standard - any compatible logger should work including Monolog and perhaps even the Laravel logger (not tested). I think it would be a good idea to add a note about this to the docs here. |
Added note to the docs about this limitation 0ca542d Thank you for bringing this to my attention |
Alright, always nice to learn new things :-) I've created my own class which forwards the logs to Laravel's Log facade. And this works perfectly.
And set the estimator:
|
I have extended the Logger of Rubix to Laravel Log facade. This works very well except when you start to use persistence.
When I try to save the estimator, I get this error:
Serialization of 'class@anonymous' is not allowed
vendor/rubix/ml/src/Persisters/Serializers/Native.php:26
Can't seem to figure out why this is happening. Logger should not be near the persistence I think.
The text was updated successfully, but these errors were encountered: