-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Custom logger shutdown order. #4045
Comments
I think this is an design issue. Loggers are created under the \System actor. So assuming you registered your custom logger in hocon like any other logger, it should run there as well. This means this is a race condition between the system actor cleaning up its children and the rest of the system shutting down. |
This can be solved easily with introducing StandardOutLogger hook for printing log events. Added pr for this #4053. |
In my humble opinion. Thats not a fix. Thats a hack. /cc @Aaronontheweb @Horusiath Opinions? |
May be it makes sense to introduce some interface like
and process childs sorted (with default to 0 if not present) ? Then we can make Logger order as int.MinValue. |
I agree with @Danthar and I closed the original PR.
The What's the business goal that you're trying to accomplish here? |
The main reason was to wrap termination messages to our nlog or hide them at all. Is there any way to suppress this output ? Assuming that logging level already set to debug before start in hocon config. |
Ah, there might be a way to hide them via configuration - let me check that |
@Aaronontheweb In my case it's very unfortunate - I have created simple console app which gets invoked with commands then do it's job and quits - like Git, for example git status shows current status then quits app. I designed it with Akka.Net - I know downsides of this decision, I know that every time I invoke app, whole actor system must be created and in my case it's acceptable performance, so this is not the subject to this comment (in the future I can move logic to separate long living process, like Docker does, invoking docker ps doesn't start up whole Docker, it just connects to deamon). Of course I want logs, so I have configured NLog to save logs to file. But I never want them in console output, as this is my user interface, so I have explicitly configured But with akka's design quoted in the beginning of this comment, every time job is done I see in my console output:
So to understand why I don't want this, imagine I that I now want to create new Git version rewritten with Akka.Net and every time user wants to see repo status sees something like this:
In my view (and this is what I asks for) this behavior should be changed and starts to respect |
Ok @tometchy - so in this case, is the ask here for us to go through and make sure that |
As for the original issue - the logger shutdown order, this might be doable with a custom |
Yes, if it's off I don't want it to be up at any moment, thanks :) |
Nah, this is definitely a bug on our part. We should just fix it so |
Moved to issue #5246 |
I am using Akka.NET 1.3.16 with NET Core 3.0 web server application and custom logger to reuse configured NLog. During ActorSystem.Terminate() sometimes logger actor stopped too early and unformatted logs printed using StandardOutLogger.
Expected behavior:
Logger actor should be stopped last during system termination.
Issue looks like
The text was updated successfully, but these errors were encountered: