wojciech.kapcia@tigase.net opened 4 years ago
|
|
@wojtek This could be done by the reload of a server configuration which we have planned. Do we want anything else? or should we just check if config reload works? |
|
I'd say the idea was to use reloading of configuration. Can we do it partially (i.e. only for mentioned |
|
@wojtek No, it is possible only to apply a new config as a whole. |
|
In that case I'm not sure we should follow that path (could you say with 100% certainty that changing log level that way would not cause reinitialising for example connection managers)? LoggingBean was just a suggestion. I looked at it and LogManager it's using and it seems it doesn't let flexible addition/removal of loggers so this may complicate things. On the other hand, we should be able to use logback via slf4j/jul bridge, which allows dynamic adjustment of log configuration (with the downside that it requires shell access for it but that's less of an issue). Bottomline, I'm leaning towards "won't fix" here, unless you see a sensible solution (ideally without reloading configuration of the whole server). |
|
@wojtek LoggingBean could reload (reconfigure) LogManager and it should work. As for not reloading and reinitializing connection managers, kernel will not create a new instance of a bean if it was already initialized. It will reuse it and apply a new configuration if it will detect that value was changed (AFAIR). |
|
should work :-) I'm just being cautions in the context of production installations - if we could be 100% certain that this would only reconfigure LogManager and wouldn't affect the rest (only update configuration at best) then this is OK. |
|
I cannot make that guarantee as we have not tested reloading of the configuration. |
|
Your first comment finished with: "Do we want anything else? or should we just check if config reload works ?" - so checking if it works seems to be enough? Though, I'd lean more towards more pin-pointed approach and directly changing LogManager configuration via LoggerBean. |
|
@wojtek I suppose we could "extend" |
|
As said during the call: that seems ok, and on top of that REST handler that access LoggerBean. |
|
I've added support for reconfiguration at runtime using ad-hoc command. As we are exposing ad-hocs to the HTTP Admin UI and REST API that will allow us to used it in a flexible way. To change logging, you have to:
I've prepared also a method in NOTE: Currently, we have |
|
I assume that disabling logging for particular package is done by configuring it with I completely agree on simplifying logger configuration. We probably won't have to explicitly use logback/slf4j given #issue #1211 (it's somewhat native JVM slf4j I'd say). |
|
@wojtek
Yes, disabling is done with
As I've mentioned, I do not care what logger we will use, but I would like to have those settings simplified in 9.0.0. |
|
Resulting command doesn't contain (our) typical
But more importantly - after executing above, no additional logging was produced in |
|
In my opinion having "Note" for success is pointless. Same as having an error with form being sent back describing an error - it should be XMPP stanza error with a text description. I would suggest to leave it without I found an issue with reconfiguration of loggers already configured in |
|
OK, I tested it some more and... it doesn't work for me. But only if I specify
But nothing from Adding
Which works just fine. I'll check it also with the next nightly, but I'd blame it on the JUL weirdness and the feature itself working.
Agreed. AFAIR I tried to return proper errors for ad-hocs in the past but reverted the change because... quite a lot of clients weren't able to handle it properly (Psi, I'm looking at you!). Discussion split out to: #issue #1214 |
|
Just an idea, maybe we should follow and idea from https://www.forward.com.au/javaProgramming/javaGuiTips/javaLoggingDebugging.html to use |
|
I think I may have an "idea" what is wrong with our config. Maybe that is just "stupid" but in the first example (produced by adhoc) class level configuration is applied before package level configuration and in the second on (which works) package level configuration is before class level configuration. This is just a wild guess but... maybe we should sort those entries before creating a property file? I'm not aware of a requirement like that in JUL but who knows. |
|
As stated at http://tutorials.jenkov.com/java-logging/configuration.html:
|
|
Well, it turns out the answer is in the javadocs of LogManager.html.readConfiguration():
I added ordering on loggers (still relevant) and applied configuration suggested in LogManager.html.updateConfiguration():
And it seems to be working fine ( @andrzej.wojcik please do take a look if it looks ok). I wonder how it was working previously as, according to the documentation, it shouldn't have… Original message:
During startup:
Reconfiguring for package
And only now the tool reports correct parent/level ("set by parent"):
But not for the currently reconfigured package:
I thought that As noted above, loggers created in classes are not visable in the current configuration until their class is loaded. This means the best place to call ~~I'm starting to suspect that
This is interesting, but in each run the most-parent-item is always first. What's curious is that the tool doesn't report any parent set for class from that particular package that was being configured. |
|
The change looks OK and if it works (even just after startup) then I would say that we have everything what we wanted. |
Type |
Task
|
Priority |
Normal
|
Assignee | |
Version |
tigase-server-8.2.0
|
Spent time |
14h
|
Sometimes we need to increase log level and can't restart the instance (ideally with REST api)
It should be possible to do via JMX, but on the other hand - we already have
Logging
bean which should accept configuration change so that feels like a better way.