Skip to content
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

Akka.Actor: need to enforce stdout-loglevel = off all the way through ActorSystem lifecycle #5246

Closed
Aaronontheweb opened this issue Sep 2, 2021 · 2 comments · Fixed by #5251
Assignees
Labels
Milestone

Comments

@Aaronontheweb
Copy link
Member

The StandardOutLogger gets started at the very end to capture any output from shutting down the other parts of the logging system as it shuts down, so it happens at the very, very end. There shouldn't be anything else important happening by this point as the rest of the application has already been terminated by the time the ActorSystem shutdown process reaches this point.

@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 stdout-loglevel = off

But with akka's design quoted in the beginning of this comment, every time job is done I see in my console output:

[DEBUG][2021-09-02 07:50:46][Thread 0009][EventStream] Shutting down: StandardOutLogger started
[DEBUG][2021-09-02 07:50:46][Thread 0009][EventStream] unsubscribing [akka://Q/system/log1-NLogLogger#918463714] from all channels

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:

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
[DEBUG][2021-09-02 07:50:46][Thread 0009][EventStream] Shutting down: StandardOutLogger started
[DEBUG][2021-09-02 07:50:46][Thread 0009][EventStream] unsubscribing [akka://Q/system/log1-NLogLogger#918463714] from all channels

In my view (and this is what I asks for) this behavior should be changed and starts to respect stdout-loglevel log level (which can be set to off) or maybe some new configuration should be added, something like start-up-stdout-during-shutdown.

Originally posted by @tometchy in #4045 (comment)

@zbynek001
Copy link
Contributor

another related feature, for better logging during shutdown, when the normal logger gets replaced by StandardOutLogger, would be to make the "minimal" logger configurable. To support custom logger, inherited from MinimalActorRef, instead of only StandardOutLogger hardcoded

@Aaronontheweb
Copy link
Member Author

@zbynek001 that's an interesting idea.... I'd be open to a PR for that provided that it has some tests + docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants