Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » How to change the logging configuration on the fly
How to change the logging configuration on the fly [message #652890] Mon, 07 February 2011 13:22 Go to next message
Frieder Heugel is currently offline Frieder HeugelFriend
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Hi everyone,

I'm wondering if it is possible to change the logging configuration without restarting Virgo. I tried to add the scan and scanPeriod attribute to the configuration element in serviceability.xml but that leads to Virgo not starting up properly. I get an org.eclipse.virgo.medic.log.impl.logback.LoggerContextConfig urationFailedException saying that it is not able to find the URL of the file to scan. Next I checked in the JMX console but couldn't find anything there. Last thing I tried was to refresh the SLF4J bundle but that leads to a lot of bundles getting refreshed and some bundles not starting up again. Moreover it doesn't recognize any change in the configuration file.

Could someone tell me if it's somehow possible to change the logging configuration without restarting Virgo?

Thx
Frieder
Re: How to change the logging configuration on the fly [message #652909 is a reply to message #652890] Mon, 07 February 2011 15:01 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
That's not something we've designed for. If you check and are pretty sure that logback has such dynamic reconfiguration capability, you might consider raising a Virgo enhancement bugzilla in case someone is interested in working on that kind of function.
Re: How to change the logging configuration on the fly [message #653043 is a reply to message #652909] Tue, 08 February 2011 08:44 Go to previous messageGo to next message
Frieder Heugel is currently offline Frieder HeugelFriend
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Hi Glyn,

I raised an enhancement bug - see 336591.

Even though I'm limited in both time and knowledge (OSGi in general and Virgo in specific) if there is anything I could help you with regarding the above mentioned bug please let me know.

Bye
Frieder
Re: How to change the logging configuration on the fly [message #653049 is a reply to message #653043] Tue, 08 February 2011 09:09 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Hi Frieder

Thanks for raising that. If you want to have a crack at providing a patch, then I suggest you start by adding Mxbeans to the Virgo Medic project to manipulate logback at runtime.

If you would like pointers on how to proceed, please join us in virgo-dev where the other committers hang out. Smile

I quite understand your limitations of time and knowledge. Creating a patch is a great way to learn and any progress or investigation you make in your limited time will help to the eventual implementation of the feature.

I'll summarise the approach in the bug and then let's use the bug for further discussions for posterity.

Regards,
Glyn
Re: How to change the logging configuration on the fly [message #653424 is a reply to message #652890] Wed, 09 February 2011 17:30 Go to previous messageGo to next message
Ric Klaren is currently offline Ric KlarenFriend
Messages: 13
Registered: July 2010
Junior Member
Adding a <jmxConfigurator /> tag to the serviceability.xml does work (partially).

You'll find the configuration in the bean:

ch.qos.logback.class/default/ch.logback.classic.jmx.JMXConfi gurator.

setLoggerLevel/getLoggerLevel work, reloadDefaultConfiguration and reloadByFileName do not work.

So for small tweaks you can use JMX.

Cheers,

Ric
Re: How to change the logging configuration on the fly [message #653426 is a reply to message #653424] Wed, 09 February 2011 17:40 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Excellent! That may help some users until the enhancement is implemented at some point in the future. Thanks!!
Re: How to change the logging configuration on the fly [message #653595 is a reply to message #653424] Thu, 10 February 2011 11:18 Go to previous message
Frieder Heugel is currently offline Frieder HeugelFriend
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Ric Klaren wrote on Wed, 09 February 2011 18:30
Adding a <jmxConfigurator /> tag to the serviceability.xml does work (partially).

[..] reloadDefaultConfiguration and reloadByFileName do not work.



Hi Ric,

thank you for the hint. I did some testing on my own and made the following observations:

(1) As you already said getLoggerLevel/setLoggerLevel/getLoggerEffectiveLevel are working fine.

(2) reloadDefaultConfiguration throws a NullPointerException and breaks the whole logging in Virgo. Though I think it's working as intended (from logback's point of view) as there are no config files available that are named logback.xml, logback-test.xml or logback.groovy. See JMXConfigurator.java#101 and ContextInitializer.java#118.

(3) reloadByFileName works fine for me in case I provide an absolute path (I used C:/Java/virgo-web-server-2.1.0.RELEASE/config/serviceability .xml). Though one has to be careful that there aren't any errors in the config file otherwise it will throw an exception and stop logging (but I guess that's more of a logback issue than a Virgo issue).

Thx
Frieder
Previous Topic:Shutdown issues after modifying Virgo's ports
Next Topic:Secure remote administration
Goto Forum:
  


Current Time: Sun Dec 08 06:34:22 GMT 2024

Powered by FUDForum. Page generated in 0.04069 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top