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

How to include quarkus-logging-manager in uberJar so it is available to modify logging level during run time #91

Closed
rreddy13Official opened this issue Jul 23, 2021 · 18 comments · Fixed by quarkusio/quarkus#19078
Assignees
Milestone

Comments

@rreddy13Official
Copy link

Hi, I see quarkus-logging-manager GUI has been added as part of quarkus DEV mode. Is there a way to include it in uber-jar so i can use this in DEV/QA/LIVE environments ?

Thanks

@phillip-kruger
Copy link
Member

Try setting quarkus.logging-manager.openapi.always-include=true in application.properties

@rreddy13Official
Copy link
Author

rreddy13Official commented Jul 23, 2021

No luck. I have added it in the configuration and tried to access GUI with:
http://localhost:8080/q/logging-manager-ui
http://localhost:8080/logging-manager-ui

@phillip-kruger
Copy link
Member

Sorry: I gave you a wrong config:

It's quarkus.logging-manager.ui.always-include=true

See https://github.com/phillip-kruger/logging-manager-example

@rreddy13Official
Copy link
Author

Thank you. It works fine now.
But a question, When I try to modify the logging level of a object that has been initialized with new, i could not find them.

Is there any way to modify the logging level of those new objects ?

@phillip-kruger
Copy link
Member

I am not following, can you share some code and more info ?

@rreddy13Official
Copy link
Author

rreddy13Official commented Jul 23, 2021

There are some beans which are not annotated with anything and they were initialized using new keyword during runtime.
example:

package org.mypackage.nestedpackage;

public class SimpleClass{
String name;
private static final Logger LOG = LoggerFactory.getLogger(SimpleClass.class);

public logSomething() {
LOG.info("something");

}

And I would like to change the log level of this class. But I could not find this class in the list (in GUI).
Please let me know if you need more details.``

@phillip-kruger
Copy link
Member

Where does LoggerFactory come from ? Have you tried with Java Util Logger or JBoss Logger ?

@rreddy13Official
Copy link
Author

rreddy13Official commented Jul 23, 2021

It comes from import org.slf4j.LoggerFactory; . I have not included any logging libraries. I think it uses quarkus logging implementation.
I can see the other classes(which are annotated with @ApplicationScoped) in the GUI list which also uses same loggingFactory and everything works great with them.
This is in both DevMode and UberJar.

@rreddy13Official
Copy link
Author

Another observation is that when running in dev mode, there are both individual classes and also packages options to modify the logging level which is nice because we can change logging level for all the classes in a package with single change. But in when built with uber-jar, there are only classes and no packages. Is there anyway to include packages also in that list ?

@phillip-kruger
Copy link
Member

I am not sure where slf4j comes from, but I do not think it's Quarkus. Try using the JBoss Logger (that comes from Quarkus)

@rreddy13Official
Copy link
Author

Hi, I have used the jboss logger still the same. :(
Its a plain simple class which is being initialized during server startup.
Trying to figure out the reason for not being listed.

@phillip-kruger
Copy link
Member

Not sure, please can you share a reproducer project, then I can look at it

@rreddy13Official
Copy link
Author

Hi, Please find an example:
https://github.com/rreddy13Official/logging-manager-example

There are two classes SimpleClass.java and SimpleApplicationScopedClass.java
When accessed GUI, I could not find SimpleClass.java which is being initialized during startup in ApplicationLifeCycleBean.java

Please let me know for more info.

@phillip-kruger
Copy link
Member

thanks ! I'll have a look a.s.a.p

@phillip-kruger
Copy link
Member

Ok, I have actually seen this before. After a while all the loggers are there. I am not sure what triggers that. This is actually a quarkus bug (you will see the same issue in the dev ui)

I'll look into this a bit more. You should be able to still use the REST endpoint and provide that logger to change the level.

@rreddy13Official
Copy link
Author

ok. Thanks for the info. Pls let us know if you find anything.

@phillip-kruger
Copy link
Member

I have fixed this (locally), I'll do a PR soon

@phillip-kruger
Copy link
Member

This is fixed in quarkus, and will be in the next minor version (2.1.0) of logging manager (waiting for the fix to be available in quarkus)

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

Successfully merging a pull request may close this issue.

2 participants