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

[MODULES-447] Make the ModuleLoggerFinder.activate() method public. A… #329

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

jamezp
Copy link
Contributor

@jamezp jamezp commented Feb 23, 2024

…lso, activate the ModuleLoggerFinder if a threshold is hit.

https://issues.redhat.com/browse/MODULES-447

Upstream #328

@@ -88,7 +89,7 @@ public System.Logger getLogger(final String name, final java.lang.Module module)
*
* @param cl the class loader to use
*/
static void activate(final ClassLoader cl) {
public static void activate(final ClassLoader cl) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not expose this API; what is the use case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are cases when, for example the WildFly Bootable JAR, we don't use org.jboss.modules.Main as the entry point so activate() is never invoked. It would be the responsibility of those callers which do not launch through the main entry point to invoke this. I do realize that is a bit odd. I'm definitely open to other options.

wildfly/wildfly-core#5882 is what I'm doing in WildFly Core for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reflection is probably still best for now. What we need to do is to create an embedding API in JBoss Modules and have a little bit more of a control over the bootstrapping process. Right now most important setup tasks are hard-coded in the main method. So ideally, we'd have a bootstrap API with error checking (e.g. "hey you already bootstrapped this once") and then the main method would reuse it. Maybe we could do some kind of design session on this in the near future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes a lot of sense to me. I'll pull the part of making the API public out, but I do think having the queue length somewhat auto-enable it makes some sense. What do you think of that part @dmlloyd?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a maximum queue length does make sense (we've done similar things in other contexts to avoid queue runaway). But I don't know if activation is the right thing to do in response to hitting the maximum. It seems more like we're just hoping that some large-ish queue depth represents that we've waited "long enough" for things to go through, doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the number is completely arbitrary for sure. I guess it would likely be strange to dump a bunch of logs. The idea of activating it was just to have the System.Logger's work rather than loosing logs.

Copy link
Contributor

@ropalka ropalka Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The introduction of JBoss Modules bootstrap API is a brilliant idea to solve kind of issues @jamezp is facing @dmlloyd ! When you'll schedule the design meeting please keep me in the loop ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered there's a JIRA for it already: https://issues.redhat.com/browse/MODULES-367

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goof find @ropalka. I've linked the two JIRA's together.

…lso, activate the ModuleLoggerFinder if a threshold is hit.

https://issues.redhat.com/browse/MODULES-447
Signed-off-by: James R. Perkins <jperkins@redhat.com>
@jamezp
Copy link
Contributor Author

jamezp commented Mar 1, 2024

I've updated this and #328 to both just activate logging if the threshold is hit. I feel like for logging we need to activate, but I also understand it might make the log messages look weird. For example, the date will definitely not be that friendly. However, they are log messages and I don't think we can just discard them. We have to do something.

Another option might be to add the timestamp to the SimpleLogRecord and if not activated promptly, default activation would be writing to System.out in some formatted pattern.

@gaol
Copy link

gaol commented Mar 20, 2024

can we merge this if it is what we wanted ? thanks

@gaol
Copy link

gaol commented Mar 27, 2024

@dmlloyd @ropalka may I ask one of you to check this please ? thanks

@dmlloyd
Copy link
Contributor

dmlloyd commented Mar 27, 2024

We are not likely going to use this solution. Discussion is ongoing regarding a potential bootstrap API which would be the replacement. It's not fully decided yet though.

@jamezp
Copy link
Contributor Author

jamezp commented Mar 27, 2024

FWIW this is now just a solution which drains the queue if it reaches an arbitrary size. We could make the size configurable with a system property.

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