You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by Andrew Jaquith <an...@gmail.com> on 2009/09/06 16:12:06 UTC

Restart logging?

Hi all --

I am doing a bunch of work on the installer/config code. I've already
got some really cool features implemented (LDAP config and live
testing, Stripesification of the interface, configuration of multiple
properties files simultaneously...). One thing I would REALLY like to
do is to be able to apply changes to the wiki WITHOUT requiring a
webapp reload.

To that end, I wrote a restart() method for the WikiEngine, and it
seems to work perfectly except in one respect: I can't figure out how
to restart the logging subsystem. Any hints? I'd like to be able to
allow the admin to specify the desired log file location, and after
restart all of the logging is redirected there.

Actually, there is one more thing: how does one set the Priha page
directory? I'm pretty sure there's a setting in priha.properties that
needs to be set, but I don't know what it is.

Andrew

Re: Restart logging?

Posted by Janne Jalkanen <ja...@ecyrd.com>.
This of course works only in the case someone is using log4j and the  
PropertyConfigurator and nothing very exotic - which is of course what  
we're doing in the default installation...

We could just output a log message that the log could not be reset in  
case it's something we don't know what it is.

/Janne

On 7 Sep 2009, at 14:55, Andrew Jaquith wrote:

> Ok, I figured it out. Google is my friend. I simply added this to the
> [new] WikiEngine.restart() method:
>
>        LogManager.resetConfiguration();
>        ClassLoader cl = this.getClass().getClassLoader();
>        URL log4jprops = cl.getResource( "log4j.properties" );
>        if (log4jprops != null)
>            PropertyConfigurator.configure(log4jprops);
>
> ...and that's all it took. I'll check this in soon.
>
> Hat-tip goes to Alan Green at bright-green.com. :)
>
> Now, this might not work if somebody swaps out their logging
> configuration, so we might want to add in some safeguards to see if
> Log4j is actually being used. But to Janne's point, this is about the
> first-use experience. Which has now improved dramatically. :)
>
> Andrew
>
> On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
> van<an...@siemens.com> wrote:
>>
>>> Another possibility is to switch to Simple logging, which always  
>>> goes
>>
>>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>>> need to provide configuration on Install.jsp, which would simplify  
>>> our
>>
>>> install process even more.
>>
>> Such simple logging would not give enough control on resource use.
>> It would be better imho to switch to log4j instead.
>>
>> Eventually a reload is shorthand for the sequence shutdown, startup.
>> Logging libraries should give their user control over when the  
>> shutdown
>> happens
>> exactly, so I would assume a reload won't be a problem if implemented
>> as a shutdown of the logging subsystem followed by a startup.
>>
>>        regards, Andre
>>
>> -----Original Message-----
>> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
>> Sent: maandag 7 september 2009 8:26
>> To: jspwiki-dev@incubator.apache.org
>> Subject: Re: Restart logging?
>>
>>
>> I don't think there's a simple way to do that through slf4j, simply
>> because log configuration is very specific to the actual logging
>> library used. For example, java.util.logging has a single global
>> LogManager, and to restart that one would mean writing our own
>> ClassLoader...
>>
>> However, since this is about first-use experience, it's unlikely that
>> someone would both be savvy enough to first switch the logging  
>> library
>> - THEN go and apply the easy-install process. So we might get away
>> simply by reconfiguring whichever logging library we happen to be
>> shipping with.
>>
>> Another possibility is to switch to Simple logging, which always goes
>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>> need to provide configuration on Install.jsp, which would simplify  
>> our
>> install process even more.
>>
>> /Janne
>>
>> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>>
>>> Hi Harry,
>>>
>>> The idea is to configure the wiki, including logging settings, using
>>> the installer screen. Then, after pressing the "Configure!" button,
>>> presto! the wiki is configured the way it should be without  
>>> needing to
>>> restart the webapp. Instant gratification! It is much better than
>>> having to restart the webapp.
>>>
>>> Right now, in my local builds, everything *except* the log file  
>>> change
>>> seems to work fine. The goal is to have the desired log file  
>>> location
>>> (configured via the installer) reflected immediately -- the logs  
>>> start
>>> going to that file. So I want to know how best to do that. Whether  
>>> it
>>> is JMX or whatever, I don't care. But I am not a logging expert;  
>>> hence
>>> the broadcast. If you have ideas I'd like to hear about them.
>>>
>>> Andrew
>>>
>>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>>> Metske<ha...@gmail.com> wrote:
>>>> Well,
>>>>
>>>> we have our own logging layer (org.apache.wiki.log) which talks to
>>>> slf4j
>>>> which talks to a real logging implementation (with log4j as the
>>>> default).
>>>> The first two don't have support for configuring logging at all,
>>>> the writer
>>>> of slf4j says you also shouldn't :
>>>> http://www.slf4j.org/faq.html#configure_logging
>>>> Log4j itself does support dynamic configuration of logging, but
>>>> that has
>>>> explicitly not been put in the slf4j interface.
>>>>
>>>> We do however have some way of dynamically configuring our loggers,
>>>> and
>>>> that's through the MBeans (currently you have to use jconsole to do
>>>> it, but
>>>> a nice GUI for it would still be nice). This is however limited.
>>>>
>>>> So with "restart logging" you could something in that direction,
>>>> but again,
>>>> that is limited to log4j, if you run another logging
>>>> implementation, you are
>>>> left alone in the dark.
>>>>
>>>> BTW, what exactly would be the difference between restarting the
>>>> engine and
>>>> reloading the whole webapp ?
>>>>
>>>> regards,
>>>> Harry
>>>>
>>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>>
>>>>> Hi all --
>>>>>
>>>>> I am doing a bunch of work on the installer/config code. I've
>>>>> already
>>>>> got some really cool features implemented (LDAP config and live
>>>>> testing, Stripesification of the interface, configuration of
>>>>> multiple
>>>>> properties files simultaneously...). One thing I would REALLY like
>>>>> to
>>>>> do is to be able to apply changes to the wiki WITHOUT requiring a
>>>>> webapp reload.
>>>>>
>>>>> To that end, I wrote a restart() method for the WikiEngine, and it
>>>>> seems to work perfectly except in one respect: I can't figure out
>>>>> how
>>>>> to restart the logging subsystem. Any hints? I'd like to be able  
>>>>> to
>>>>> allow the admin to specify the desired log file location, and  
>>>>> after
>>>>> restart all of the logging is redirected there.
>>>>>
>>>>> Actually, there is one more thing: how does one set the Priha page
>>>>> directory? I'm pretty sure there's a setting in priha.properties
>>>>> that
>>>>> needs to be set, but I don't know what it is.
>>>>>
>>>>> Andrew
>>>>>
>>>>
>>
>>


Re: Restart logging?

Posted by Andrew Jaquith <an...@gmail.com>.
Cool. That suggests a fix to ContentManager should be possible, then. :)

On Sep 8, 2009, at 12:37, Janne Jalkanen <Ja...@ecyrd.com>  
wrote:

>
> The JSR-170 spec says nothing about this... So it's entirely  
> possible that you end up leaking memory and resources all over the  
> place. :-(
>
> Priha RepositoryManager only caches the default repository instance  
> (getRepository()).  Calling RepositoryManager.getRepository 
> ( "priha.properties" ) gives you a new instance every time.
>
> /Janne
>
> On Sep 8, 2009, at 22:13 , Andrew Jaquith wrote:
>
>> Hi Janne --
>>
>> A little experimentation with the live-install code suggests that  
>> Priha's RepositoryManager doesn't know how to un-cache its  
>> RepositoryImpl instances. Or to put it differently, there doesn't  
>> seem to be a way to reload or restart one.
>>
>> Thoughts?
>>
>> On Sep 7, 2009, at 13:04, Janne Jalkanen <ja...@ecyrd.com>  
>> wrote:
>>
>>>
>>> I'm not sure anybody thinks that slf4j was a bad idea :-).  I  
>>> think Andrew's solution below is ok (though we might want to use  
>>> Reflection to find the PropertyConfigurator).  It's good enough  
>>> for first-use experience certainly, since we ship with log4j  
>>> enabled by default. Besides, since Install.jsp only knows how to  
>>> configure log4j, we don't need this functionality for anyone else  
>>> either.
>>>
>>> Also, I think some log libs know how to reload themselves if you  
>>> change the config file.
>>>
>>> /Janne
>>>
>>> On 7 Sep 2009, at 21:55, Harry Metske wrote:
>>>
>>>> Andrew,
>>>> see https://issues.apache.org/jira/browse/JSPWIKI-376
>>>>
>>>> We have implemented slf4j to abstract away from specific logging
>>>> implementations.
>>>> PropertyConfigurator is a log4j specific class, if you would  
>>>> directly use
>>>> that class as coded below, you would revert all the effort done in
>>>> JSPWIKI-376 and we would rely again on log4j.
>>>> What you should at least do is first check if log4j is on the  
>>>> classpath and
>>>> then use reflection to get to the PropertyConfigurator. If there  
>>>> is no log4j
>>>> on the classpath we should disappoint the user by saying "sorry,  
>>>> no log4j
>>>> present, we can't do reconfigure logging right now".
>>>> LoggerFactory.registerLoggerMBean does a similar classpath-check/ 
>>>> reflection
>>>> trick.
>>>> If we all think that slf4j abstraction wasn't a good idea because  
>>>> we have
>>>> thrown away all the log4j-specific goodies, we should get rid of  
>>>> slf4j
>>>> again, thereby reverting JSPWIKI-376. (vote ?)
>>>>
>>>> A sort of meet in the middle might be to only change the  
>>>> log4j.properties
>>>> file, and require a webapp reload for the "logging restart" to  
>>>> work.
>>>>
>>>> regards,
>>>> Harry
>>>>
>>>> 2009/9/7 Andrew Jaquith <an...@gmail.com>
>>>>
>>>>> Ok, I figured it out. Google is my friend. I simply added this  
>>>>> to the
>>>>> [new] WikiEngine.restart() method:
>>>>>
>>>>>    LogManager.resetConfiguration();
>>>>>    ClassLoader cl = this.getClass().getClassLoader();
>>>>>    URL log4jprops = cl.getResource( "log4j.properties" );
>>>>>    if (log4jprops != null)
>>>>>        PropertyConfigurator.configure(log4jprops);
>>>>>
>>>>> ...and that's all it took. I'll check this in soon.
>>>>>
>>>>> Hat-tip goes to Alan Green at bright-green.com. :)
>>>>>
>>>>> Now, this might not work if somebody swaps out their logging
>>>>> configuration, so we might want to add in some safeguards to see  
>>>>> if
>>>>> Log4j is actually being used. But to Janne's point, this is  
>>>>> about the
>>>>> first-use experience. Which has now improved dramatically. :)
>>>>>
>>>>> Andrew
>>>>>
>>>>> On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
>>>>> van<an...@siemens.com> wrote:
>>>>>>
>>>>>>> Another possibility is to switch to Simple logging, which  
>>>>>>> always goes
>>>>>>
>>>>>>> to stdout - in Tomcat's case, catalina.out.  Then there would  
>>>>>>> be no
>>>>>>> need to provide configuration on Install.jsp, which would  
>>>>>>> simplify our
>>>>>>
>>>>>>> install process even more.
>>>>>>
>>>>>> Such simple logging would not give enough control on resource  
>>>>>> use.
>>>>>> It would be better imho to switch to log4j instead.
>>>>>>
>>>>>> Eventually a reload is shorthand for the sequence shutdown,  
>>>>>> startup.
>>>>>> Logging libraries should give their user control over when the  
>>>>>> shutdown
>>>>>> happens
>>>>>> exactly, so I would assume a reload won't be a problem if  
>>>>>> implemented
>>>>>> as a shutdown of the logging subsystem followed by a startup.
>>>>>>
>>>>>>    regards, Andre
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
>>>>>> Sent: maandag 7 september 2009 8:26
>>>>>> To: jspwiki-dev@incubator.apache.org
>>>>>> Subject: Re: Restart logging?
>>>>>>
>>>>>>
>>>>>> I don't think there's a simple way to do that through slf4j,  
>>>>>> simply
>>>>>> because log configuration is very specific to the actual logging
>>>>>> library used. For example, java.util.logging has a single global
>>>>>> LogManager, and to restart that one would mean writing our own
>>>>>> ClassLoader...
>>>>>>
>>>>>> However, since this is about first-use experience, it's  
>>>>>> unlikely that
>>>>>> someone would both be savvy enough to first switch the logging  
>>>>>> library
>>>>>> - THEN go and apply the easy-install process. So we might get  
>>>>>> away
>>>>>> simply by reconfiguring whichever logging library we happen to be
>>>>>> shipping with.
>>>>>>
>>>>>> Another possibility is to switch to Simple logging, which  
>>>>>> always goes
>>>>>> to stdout - in Tomcat's case, catalina.out.  Then there would  
>>>>>> be no
>>>>>> need to provide configuration on Install.jsp, which would  
>>>>>> simplify our
>>>>>> install process even more.
>>>>>>
>>>>>> /Janne
>>>>>>
>>>>>> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>>>>>>
>>>>>>> Hi Harry,
>>>>>>>
>>>>>>> The idea is to configure the wiki, including logging settings,  
>>>>>>> using
>>>>>>> the installer screen. Then, after pressing the "Configure!"  
>>>>>>> button,
>>>>>>> presto! the wiki is configured the way it should be without  
>>>>>>> needing to
>>>>>>> restart the webapp. Instant gratification! It is much better  
>>>>>>> than
>>>>>>> having to restart the webapp.
>>>>>>>
>>>>>>> Right now, in my local builds, everything *except* the log  
>>>>>>> file change
>>>>>>> seems to work fine. The goal is to have the desired log file  
>>>>>>> location
>>>>>>> (configured via the installer) reflected immediately -- the  
>>>>>>> logs start
>>>>>>> going to that file. So I want to know how best to do that.  
>>>>>>> Whether it
>>>>>>> is JMX or whatever, I don't care. But I am not a logging  
>>>>>>> expert; hence
>>>>>>> the broadcast. If you have ideas I'd like to hear about them.
>>>>>>>
>>>>>>> Andrew
>>>>>>>
>>>>>>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>>>>>>> Metske<ha...@gmail.com> wrote:
>>>>>>>> Well,
>>>>>>>>
>>>>>>>> we have our own logging layer (org.apache.wiki.log) which  
>>>>>>>> talks to
>>>>>>>> slf4j
>>>>>>>> which talks to a real logging implementation (with log4j as the
>>>>>>>> default).
>>>>>>>> The first two don't have support for configuring logging at  
>>>>>>>> all,
>>>>>>>> the writer
>>>>>>>> of slf4j says you also shouldn't :
>>>>>>>> http://www.slf4j.org/faq.html#configure_logging
>>>>>>>> Log4j itself does support dynamic configuration of logging, but
>>>>>>>> that has
>>>>>>>> explicitly not been put in the slf4j interface.
>>>>>>>>
>>>>>>>> We do however have some way of dynamically configuring our  
>>>>>>>> loggers,
>>>>>>>> and
>>>>>>>> that's through the MBeans (currently you have to use jconsole  
>>>>>>>> to do
>>>>>>>> it, but
>>>>>>>> a nice GUI for it would still be nice). This is however  
>>>>>>>> limited.
>>>>>>>>
>>>>>>>> So with "restart logging" you could something in that  
>>>>>>>> direction,
>>>>>>>> but again,
>>>>>>>> that is limited to log4j, if you run another logging
>>>>>>>> implementation, you are
>>>>>>>> left alone in the dark.
>>>>>>>>
>>>>>>>> BTW, what exactly would be the difference between restarting  
>>>>>>>> the
>>>>>>>> engine and
>>>>>>>> reloading the whole webapp ?
>>>>>>>>
>>>>>>>> regards,
>>>>>>>> Harry
>>>>>>>>
>>>>>>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>>>>>>
>>>>>>>>> Hi all --
>>>>>>>>>
>>>>>>>>> I am doing a bunch of work on the installer/config code. I've
>>>>>>>>> already
>>>>>>>>> got some really cool features implemented (LDAP config and  
>>>>>>>>> live
>>>>>>>>> testing, Stripesification of the interface, configuration of
>>>>>>>>> multiple
>>>>>>>>> properties files simultaneously...). One thing I would  
>>>>>>>>> REALLY like
>>>>>>>>> to
>>>>>>>>> do is to be able to apply changes to the wiki WITHOUT  
>>>>>>>>> requiring a
>>>>>>>>> webapp reload.
>>>>>>>>>
>>>>>>>>> To that end, I wrote a restart() method for the WikiEngine,  
>>>>>>>>> and it
>>>>>>>>> seems to work perfectly except in one respect: I can't  
>>>>>>>>> figure out
>>>>>>>>> how
>>>>>>>>> to restart the logging subsystem. Any hints? I'd like to be  
>>>>>>>>> able to
>>>>>>>>> allow the admin to specify the desired log file location,  
>>>>>>>>> and after
>>>>>>>>> restart all of the logging is redirected there.
>>>>>>>>>
>>>>>>>>> Actually, there is one more thing: how does one set the  
>>>>>>>>> Priha page
>>>>>>>>> directory? I'm pretty sure there's a setting in  
>>>>>>>>> priha.properties
>>>>>>>>> that
>>>>>>>>> needs to be set, but I don't know what it is.
>>>>>>>>>
>>>>>>>>> Andrew
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>

Re: Restart logging?

Posted by Janne Jalkanen <Ja...@ecyrd.com>.
The JSR-170 spec says nothing about this... So it's entirely possible  
that you end up leaking memory and resources all over the place. :-(

Priha RepositoryManager only caches the default repository instance  
(getRepository()).  Calling  
RepositoryManager.getRepository( "priha.properties" ) gives you a new  
instance every time.

/Janne

On Sep 8, 2009, at 22:13 , Andrew Jaquith wrote:

> Hi Janne --
>
> A little experimentation with the live-install code suggests that  
> Priha's RepositoryManager doesn't know how to un-cache its  
> RepositoryImpl instances. Or to put it differently, there doesn't  
> seem to be a way to reload or restart one.
>
> Thoughts?
>
> On Sep 7, 2009, at 13:04, Janne Jalkanen <ja...@ecyrd.com>  
> wrote:
>
>>
>> I'm not sure anybody thinks that slf4j was a bad idea :-).  I think  
>> Andrew's solution below is ok (though we might want to use  
>> Reflection to find the PropertyConfigurator).  It's good enough for  
>> first-use experience certainly, since we ship with log4j enabled by  
>> default. Besides, since Install.jsp only knows how to configure  
>> log4j, we don't need this functionality for anyone else either.
>>
>> Also, I think some log libs know how to reload themselves if you  
>> change the config file.
>>
>> /Janne
>>
>> On 7 Sep 2009, at 21:55, Harry Metske wrote:
>>
>>> Andrew,
>>> see https://issues.apache.org/jira/browse/JSPWIKI-376
>>>
>>> We have implemented slf4j to abstract away from specific logging
>>> implementations.
>>> PropertyConfigurator is a log4j specific class, if you would  
>>> directly use
>>> that class as coded below, you would revert all the effort done in
>>> JSPWIKI-376 and we would rely again on log4j.
>>> What you should at least do is first check if log4j is on the  
>>> classpath and
>>> then use reflection to get to the PropertyConfigurator. If there  
>>> is no log4j
>>> on the classpath we should disappoint the user by saying "sorry,  
>>> no log4j
>>> present, we can't do reconfigure logging right now".
>>> LoggerFactory.registerLoggerMBean does a similar classpath-check/ 
>>> reflection
>>> trick.
>>> If we all think that slf4j abstraction wasn't a good idea because  
>>> we have
>>> thrown away all the log4j-specific goodies, we should get rid of  
>>> slf4j
>>> again, thereby reverting JSPWIKI-376. (vote ?)
>>>
>>> A sort of meet in the middle might be to only change the  
>>> log4j.properties
>>> file, and require a webapp reload for the "logging restart" to work.
>>>
>>> regards,
>>> Harry
>>>
>>> 2009/9/7 Andrew Jaquith <an...@gmail.com>
>>>
>>>> Ok, I figured it out. Google is my friend. I simply added this to  
>>>> the
>>>> [new] WikiEngine.restart() method:
>>>>
>>>>     LogManager.resetConfiguration();
>>>>     ClassLoader cl = this.getClass().getClassLoader();
>>>>     URL log4jprops = cl.getResource( "log4j.properties" );
>>>>     if (log4jprops != null)
>>>>         PropertyConfigurator.configure(log4jprops);
>>>>
>>>> ...and that's all it took. I'll check this in soon.
>>>>
>>>> Hat-tip goes to Alan Green at bright-green.com. :)
>>>>
>>>> Now, this might not work if somebody swaps out their logging
>>>> configuration, so we might want to add in some safeguards to see if
>>>> Log4j is actually being used. But to Janne's point, this is about  
>>>> the
>>>> first-use experience. Which has now improved dramatically. :)
>>>>
>>>> Andrew
>>>>
>>>> On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
>>>> van<an...@siemens.com> wrote:
>>>>>
>>>>>> Another possibility is to switch to Simple logging, which  
>>>>>> always goes
>>>>>
>>>>>> to stdout - in Tomcat's case, catalina.out.  Then there would  
>>>>>> be no
>>>>>> need to provide configuration on Install.jsp, which would  
>>>>>> simplify our
>>>>>
>>>>>> install process even more.
>>>>>
>>>>> Such simple logging would not give enough control on resource use.
>>>>> It would be better imho to switch to log4j instead.
>>>>>
>>>>> Eventually a reload is shorthand for the sequence shutdown,  
>>>>> startup.
>>>>> Logging libraries should give their user control over when the  
>>>>> shutdown
>>>>> happens
>>>>> exactly, so I would assume a reload won't be a problem if  
>>>>> implemented
>>>>> as a shutdown of the logging subsystem followed by a startup.
>>>>>
>>>>>     regards, Andre
>>>>>
>>>>> -----Original Message-----
>>>>> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
>>>>> Sent: maandag 7 september 2009 8:26
>>>>> To: jspwiki-dev@incubator.apache.org
>>>>> Subject: Re: Restart logging?
>>>>>
>>>>>
>>>>> I don't think there's a simple way to do that through slf4j,  
>>>>> simply
>>>>> because log configuration is very specific to the actual logging
>>>>> library used. For example, java.util.logging has a single global
>>>>> LogManager, and to restart that one would mean writing our own
>>>>> ClassLoader...
>>>>>
>>>>> However, since this is about first-use experience, it's unlikely  
>>>>> that
>>>>> someone would both be savvy enough to first switch the logging  
>>>>> library
>>>>> - THEN go and apply the easy-install process. So we might get away
>>>>> simply by reconfiguring whichever logging library we happen to be
>>>>> shipping with.
>>>>>
>>>>> Another possibility is to switch to Simple logging, which always  
>>>>> goes
>>>>> to stdout - in Tomcat's case, catalina.out.  Then there would be  
>>>>> no
>>>>> need to provide configuration on Install.jsp, which would  
>>>>> simplify our
>>>>> install process even more.
>>>>>
>>>>> /Janne
>>>>>
>>>>> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>>>>>
>>>>>> Hi Harry,
>>>>>>
>>>>>> The idea is to configure the wiki, including logging settings,  
>>>>>> using
>>>>>> the installer screen. Then, after pressing the "Configure!"  
>>>>>> button,
>>>>>> presto! the wiki is configured the way it should be without  
>>>>>> needing to
>>>>>> restart the webapp. Instant gratification! It is much better than
>>>>>> having to restart the webapp.
>>>>>>
>>>>>> Right now, in my local builds, everything *except* the log file  
>>>>>> change
>>>>>> seems to work fine. The goal is to have the desired log file  
>>>>>> location
>>>>>> (configured via the installer) reflected immediately -- the  
>>>>>> logs start
>>>>>> going to that file. So I want to know how best to do that.  
>>>>>> Whether it
>>>>>> is JMX or whatever, I don't care. But I am not a logging  
>>>>>> expert; hence
>>>>>> the broadcast. If you have ideas I'd like to hear about them.
>>>>>>
>>>>>> Andrew
>>>>>>
>>>>>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>>>>>> Metske<ha...@gmail.com> wrote:
>>>>>>> Well,
>>>>>>>
>>>>>>> we have our own logging layer (org.apache.wiki.log) which  
>>>>>>> talks to
>>>>>>> slf4j
>>>>>>> which talks to a real logging implementation (with log4j as the
>>>>>>> default).
>>>>>>> The first two don't have support for configuring logging at all,
>>>>>>> the writer
>>>>>>> of slf4j says you also shouldn't :
>>>>>>> http://www.slf4j.org/faq.html#configure_logging
>>>>>>> Log4j itself does support dynamic configuration of logging, but
>>>>>>> that has
>>>>>>> explicitly not been put in the slf4j interface.
>>>>>>>
>>>>>>> We do however have some way of dynamically configuring our  
>>>>>>> loggers,
>>>>>>> and
>>>>>>> that's through the MBeans (currently you have to use jconsole  
>>>>>>> to do
>>>>>>> it, but
>>>>>>> a nice GUI for it would still be nice). This is however limited.
>>>>>>>
>>>>>>> So with "restart logging" you could something in that direction,
>>>>>>> but again,
>>>>>>> that is limited to log4j, if you run another logging
>>>>>>> implementation, you are
>>>>>>> left alone in the dark.
>>>>>>>
>>>>>>> BTW, what exactly would be the difference between restarting the
>>>>>>> engine and
>>>>>>> reloading the whole webapp ?
>>>>>>>
>>>>>>> regards,
>>>>>>> Harry
>>>>>>>
>>>>>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>>>>>
>>>>>>>> Hi all --
>>>>>>>>
>>>>>>>> I am doing a bunch of work on the installer/config code. I've
>>>>>>>> already
>>>>>>>> got some really cool features implemented (LDAP config and live
>>>>>>>> testing, Stripesification of the interface, configuration of
>>>>>>>> multiple
>>>>>>>> properties files simultaneously...). One thing I would REALLY  
>>>>>>>> like
>>>>>>>> to
>>>>>>>> do is to be able to apply changes to the wiki WITHOUT  
>>>>>>>> requiring a
>>>>>>>> webapp reload.
>>>>>>>>
>>>>>>>> To that end, I wrote a restart() method for the WikiEngine,  
>>>>>>>> and it
>>>>>>>> seems to work perfectly except in one respect: I can't figure  
>>>>>>>> out
>>>>>>>> how
>>>>>>>> to restart the logging subsystem. Any hints? I'd like to be  
>>>>>>>> able to
>>>>>>>> allow the admin to specify the desired log file location, and  
>>>>>>>> after
>>>>>>>> restart all of the logging is redirected there.
>>>>>>>>
>>>>>>>> Actually, there is one more thing: how does one set the Priha  
>>>>>>>> page
>>>>>>>> directory? I'm pretty sure there's a setting in  
>>>>>>>> priha.properties
>>>>>>>> that
>>>>>>>> needs to be set, but I don't know what it is.
>>>>>>>>
>>>>>>>> Andrew
>>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>


Re: Restart logging?

Posted by Andrew Jaquith <an...@gmail.com>.
Hi Janne --

A little experimentation with the live-install code suggests that  
Priha's RepositoryManager doesn't know how to un-cache its  
RepositoryImpl instances. Or to put it differently, there doesn't seem  
to be a way to reload or restart one.

Thoughts?

On Sep 7, 2009, at 13:04, Janne Jalkanen <ja...@ecyrd.com>  
wrote:

>
> I'm not sure anybody thinks that slf4j was a bad idea :-).  I think  
> Andrew's solution below is ok (though we might want to use  
> Reflection to find the PropertyConfigurator).  It's good enough for  
> first-use experience certainly, since we ship with log4j enabled by  
> default. Besides, since Install.jsp only knows how to configure  
> log4j, we don't need this functionality for anyone else either.
>
> Also, I think some log libs know how to reload themselves if you  
> change the config file.
>
> /Janne
>
> On 7 Sep 2009, at 21:55, Harry Metske wrote:
>
>> Andrew,
>> see https://issues.apache.org/jira/browse/JSPWIKI-376
>>
>> We have implemented slf4j to abstract away from specific logging
>> implementations.
>> PropertyConfigurator is a log4j specific class, if you would  
>> directly use
>> that class as coded below, you would revert all the effort done in
>> JSPWIKI-376 and we would rely again on log4j.
>> What you should at least do is first check if log4j is on the  
>> classpath and
>> then use reflection to get to the PropertyConfigurator. If there is  
>> no log4j
>> on the classpath we should disappoint the user by saying "sorry, no  
>> log4j
>> present, we can't do reconfigure logging right now".
>> LoggerFactory.registerLoggerMBean does a similar classpath-check/ 
>> reflection
>> trick.
>> If we all think that slf4j abstraction wasn't a good idea because  
>> we have
>> thrown away all the log4j-specific goodies, we should get rid of  
>> slf4j
>> again, thereby reverting JSPWIKI-376. (vote ?)
>>
>> A sort of meet in the middle might be to only change the  
>> log4j.properties
>> file, and require a webapp reload for the "logging restart" to work.
>>
>> regards,
>> Harry
>>
>> 2009/9/7 Andrew Jaquith <an...@gmail.com>
>>
>>> Ok, I figured it out. Google is my friend. I simply added this to  
>>> the
>>> [new] WikiEngine.restart() method:
>>>
>>>      LogManager.resetConfiguration();
>>>      ClassLoader cl = this.getClass().getClassLoader();
>>>      URL log4jprops = cl.getResource( "log4j.properties" );
>>>      if (log4jprops != null)
>>>          PropertyConfigurator.configure(log4jprops);
>>>
>>> ...and that's all it took. I'll check this in soon.
>>>
>>> Hat-tip goes to Alan Green at bright-green.com. :)
>>>
>>> Now, this might not work if somebody swaps out their logging
>>> configuration, so we might want to add in some safeguards to see if
>>> Log4j is actually being used. But to Janne's point, this is about  
>>> the
>>> first-use experience. Which has now improved dramatically. :)
>>>
>>> Andrew
>>>
>>> On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
>>> van<an...@siemens.com> wrote:
>>>>
>>>>> Another possibility is to switch to Simple logging, which always  
>>>>> goes
>>>>
>>>>> to stdout - in Tomcat's case, catalina.out.  Then there would be  
>>>>> no
>>>>> need to provide configuration on Install.jsp, which would  
>>>>> simplify our
>>>>
>>>>> install process even more.
>>>>
>>>> Such simple logging would not give enough control on resource use.
>>>> It would be better imho to switch to log4j instead.
>>>>
>>>> Eventually a reload is shorthand for the sequence shutdown,  
>>>> startup.
>>>> Logging libraries should give their user control over when the  
>>>> shutdown
>>>> happens
>>>> exactly, so I would assume a reload won't be a problem if  
>>>> implemented
>>>> as a shutdown of the logging subsystem followed by a startup.
>>>>
>>>>      regards, Andre
>>>>
>>>> -----Original Message-----
>>>> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
>>>> Sent: maandag 7 september 2009 8:26
>>>> To: jspwiki-dev@incubator.apache.org
>>>> Subject: Re: Restart logging?
>>>>
>>>>
>>>> I don't think there's a simple way to do that through slf4j, simply
>>>> because log configuration is very specific to the actual logging
>>>> library used. For example, java.util.logging has a single global
>>>> LogManager, and to restart that one would mean writing our own
>>>> ClassLoader...
>>>>
>>>> However, since this is about first-use experience, it's unlikely  
>>>> that
>>>> someone would both be savvy enough to first switch the logging  
>>>> library
>>>> - THEN go and apply the easy-install process. So we might get away
>>>> simply by reconfiguring whichever logging library we happen to be
>>>> shipping with.
>>>>
>>>> Another possibility is to switch to Simple logging, which always  
>>>> goes
>>>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>>>> need to provide configuration on Install.jsp, which would  
>>>> simplify our
>>>> install process even more.
>>>>
>>>> /Janne
>>>>
>>>> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>>>>
>>>>> Hi Harry,
>>>>>
>>>>> The idea is to configure the wiki, including logging settings,  
>>>>> using
>>>>> the installer screen. Then, after pressing the "Configure!"  
>>>>> button,
>>>>> presto! the wiki is configured the way it should be without  
>>>>> needing to
>>>>> restart the webapp. Instant gratification! It is much better than
>>>>> having to restart the webapp.
>>>>>
>>>>> Right now, in my local builds, everything *except* the log file  
>>>>> change
>>>>> seems to work fine. The goal is to have the desired log file  
>>>>> location
>>>>> (configured via the installer) reflected immediately -- the logs  
>>>>> start
>>>>> going to that file. So I want to know how best to do that.  
>>>>> Whether it
>>>>> is JMX or whatever, I don't care. But I am not a logging expert;  
>>>>> hence
>>>>> the broadcast. If you have ideas I'd like to hear about them.
>>>>>
>>>>> Andrew
>>>>>
>>>>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>>>>> Metske<ha...@gmail.com> wrote:
>>>>>> Well,
>>>>>>
>>>>>> we have our own logging layer (org.apache.wiki.log) which talks  
>>>>>> to
>>>>>> slf4j
>>>>>> which talks to a real logging implementation (with log4j as the
>>>>>> default).
>>>>>> The first two don't have support for configuring logging at all,
>>>>>> the writer
>>>>>> of slf4j says you also shouldn't :
>>>>>> http://www.slf4j.org/faq.html#configure_logging
>>>>>> Log4j itself does support dynamic configuration of logging, but
>>>>>> that has
>>>>>> explicitly not been put in the slf4j interface.
>>>>>>
>>>>>> We do however have some way of dynamically configuring our  
>>>>>> loggers,
>>>>>> and
>>>>>> that's through the MBeans (currently you have to use jconsole  
>>>>>> to do
>>>>>> it, but
>>>>>> a nice GUI for it would still be nice). This is however limited.
>>>>>>
>>>>>> So with "restart logging" you could something in that direction,
>>>>>> but again,
>>>>>> that is limited to log4j, if you run another logging
>>>>>> implementation, you are
>>>>>> left alone in the dark.
>>>>>>
>>>>>> BTW, what exactly would be the difference between restarting the
>>>>>> engine and
>>>>>> reloading the whole webapp ?
>>>>>>
>>>>>> regards,
>>>>>> Harry
>>>>>>
>>>>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>>>>
>>>>>>> Hi all --
>>>>>>>
>>>>>>> I am doing a bunch of work on the installer/config code. I've
>>>>>>> already
>>>>>>> got some really cool features implemented (LDAP config and live
>>>>>>> testing, Stripesification of the interface, configuration of
>>>>>>> multiple
>>>>>>> properties files simultaneously...). One thing I would REALLY  
>>>>>>> like
>>>>>>> to
>>>>>>> do is to be able to apply changes to the wiki WITHOUT  
>>>>>>> requiring a
>>>>>>> webapp reload.
>>>>>>>
>>>>>>> To that end, I wrote a restart() method for the WikiEngine,  
>>>>>>> and it
>>>>>>> seems to work perfectly except in one respect: I can't figure  
>>>>>>> out
>>>>>>> how
>>>>>>> to restart the logging subsystem. Any hints? I'd like to be  
>>>>>>> able to
>>>>>>> allow the admin to specify the desired log file location, and  
>>>>>>> after
>>>>>>> restart all of the logging is redirected there.
>>>>>>>
>>>>>>> Actually, there is one more thing: how does one set the Priha  
>>>>>>> page
>>>>>>> directory? I'm pretty sure there's a setting in priha.properties
>>>>>>> that
>>>>>>> needs to be set, but I don't know what it is.
>>>>>>>
>>>>>>> Andrew
>>>>>>>
>>>>>>
>>>>
>>>>
>>>
>

Re: Restart logging?

Posted by Janne Jalkanen <ja...@ecyrd.com>.
I'm not sure anybody thinks that slf4j was a bad idea :-).  I think  
Andrew's solution below is ok (though we might want to use Reflection  
to find the PropertyConfigurator).  It's good enough for first-use  
experience certainly, since we ship with log4j enabled by default.  
Besides, since Install.jsp only knows how to configure log4j, we don't  
need this functionality for anyone else either.

Also, I think some log libs know how to reload themselves if you  
change the config file.

/Janne

On 7 Sep 2009, at 21:55, Harry Metske wrote:

> Andrew,
> see https://issues.apache.org/jira/browse/JSPWIKI-376
>
> We have implemented slf4j to abstract away from specific logging
> implementations.
> PropertyConfigurator is a log4j specific class, if you would  
> directly use
> that class as coded below, you would revert all the effort done in
> JSPWIKI-376 and we would rely again on log4j.
> What you should at least do is first check if log4j is on the  
> classpath and
> then use reflection to get to the PropertyConfigurator. If there is  
> no log4j
> on the classpath we should disappoint the user by saying "sorry, no  
> log4j
> present, we can't do reconfigure logging right now".
> LoggerFactory.registerLoggerMBean does a similar classpath-check/ 
> reflection
> trick.
> If we all think that slf4j abstraction wasn't a good idea because we  
> have
> thrown away all the log4j-specific goodies, we should get rid of slf4j
> again, thereby reverting JSPWIKI-376. (vote ?)
>
> A sort of meet in the middle might be to only change the  
> log4j.properties
> file, and require a webapp reload for the "logging restart" to work.
>
> regards,
> Harry
>
> 2009/9/7 Andrew Jaquith <an...@gmail.com>
>
>> Ok, I figured it out. Google is my friend. I simply added this to the
>> [new] WikiEngine.restart() method:
>>
>>       LogManager.resetConfiguration();
>>       ClassLoader cl = this.getClass().getClassLoader();
>>       URL log4jprops = cl.getResource( "log4j.properties" );
>>       if (log4jprops != null)
>>           PropertyConfigurator.configure(log4jprops);
>>
>> ...and that's all it took. I'll check this in soon.
>>
>> Hat-tip goes to Alan Green at bright-green.com. :)
>>
>> Now, this might not work if somebody swaps out their logging
>> configuration, so we might want to add in some safeguards to see if
>> Log4j is actually being used. But to Janne's point, this is about the
>> first-use experience. Which has now improved dramatically. :)
>>
>> Andrew
>>
>> On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
>> van<an...@siemens.com> wrote:
>>>
>>>> Another possibility is to switch to Simple logging, which always  
>>>> goes
>>>
>>>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>>>> need to provide configuration on Install.jsp, which would  
>>>> simplify our
>>>
>>>> install process even more.
>>>
>>> Such simple logging would not give enough control on resource use.
>>> It would be better imho to switch to log4j instead.
>>>
>>> Eventually a reload is shorthand for the sequence shutdown, startup.
>>> Logging libraries should give their user control over when the  
>>> shutdown
>>> happens
>>> exactly, so I would assume a reload won't be a problem if  
>>> implemented
>>> as a shutdown of the logging subsystem followed by a startup.
>>>
>>>       regards, Andre
>>>
>>> -----Original Message-----
>>> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
>>> Sent: maandag 7 september 2009 8:26
>>> To: jspwiki-dev@incubator.apache.org
>>> Subject: Re: Restart logging?
>>>
>>>
>>> I don't think there's a simple way to do that through slf4j, simply
>>> because log configuration is very specific to the actual logging
>>> library used. For example, java.util.logging has a single global
>>> LogManager, and to restart that one would mean writing our own
>>> ClassLoader...
>>>
>>> However, since this is about first-use experience, it's unlikely  
>>> that
>>> someone would both be savvy enough to first switch the logging  
>>> library
>>> - THEN go and apply the easy-install process. So we might get away
>>> simply by reconfiguring whichever logging library we happen to be
>>> shipping with.
>>>
>>> Another possibility is to switch to Simple logging, which always  
>>> goes
>>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>>> need to provide configuration on Install.jsp, which would simplify  
>>> our
>>> install process even more.
>>>
>>> /Janne
>>>
>>> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>>>
>>>> Hi Harry,
>>>>
>>>> The idea is to configure the wiki, including logging settings,  
>>>> using
>>>> the installer screen. Then, after pressing the "Configure!" button,
>>>> presto! the wiki is configured the way it should be without  
>>>> needing to
>>>> restart the webapp. Instant gratification! It is much better than
>>>> having to restart the webapp.
>>>>
>>>> Right now, in my local builds, everything *except* the log file  
>>>> change
>>>> seems to work fine. The goal is to have the desired log file  
>>>> location
>>>> (configured via the installer) reflected immediately -- the logs  
>>>> start
>>>> going to that file. So I want to know how best to do that.  
>>>> Whether it
>>>> is JMX or whatever, I don't care. But I am not a logging expert;  
>>>> hence
>>>> the broadcast. If you have ideas I'd like to hear about them.
>>>>
>>>> Andrew
>>>>
>>>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>>>> Metske<ha...@gmail.com> wrote:
>>>>> Well,
>>>>>
>>>>> we have our own logging layer (org.apache.wiki.log) which talks to
>>>>> slf4j
>>>>> which talks to a real logging implementation (with log4j as the
>>>>> default).
>>>>> The first two don't have support for configuring logging at all,
>>>>> the writer
>>>>> of slf4j says you also shouldn't :
>>>>> http://www.slf4j.org/faq.html#configure_logging
>>>>> Log4j itself does support dynamic configuration of logging, but
>>>>> that has
>>>>> explicitly not been put in the slf4j interface.
>>>>>
>>>>> We do however have some way of dynamically configuring our  
>>>>> loggers,
>>>>> and
>>>>> that's through the MBeans (currently you have to use jconsole to  
>>>>> do
>>>>> it, but
>>>>> a nice GUI for it would still be nice). This is however limited.
>>>>>
>>>>> So with "restart logging" you could something in that direction,
>>>>> but again,
>>>>> that is limited to log4j, if you run another logging
>>>>> implementation, you are
>>>>> left alone in the dark.
>>>>>
>>>>> BTW, what exactly would be the difference between restarting the
>>>>> engine and
>>>>> reloading the whole webapp ?
>>>>>
>>>>> regards,
>>>>> Harry
>>>>>
>>>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>>>
>>>>>> Hi all --
>>>>>>
>>>>>> I am doing a bunch of work on the installer/config code. I've
>>>>>> already
>>>>>> got some really cool features implemented (LDAP config and live
>>>>>> testing, Stripesification of the interface, configuration of
>>>>>> multiple
>>>>>> properties files simultaneously...). One thing I would REALLY  
>>>>>> like
>>>>>> to
>>>>>> do is to be able to apply changes to the wiki WITHOUT requiring a
>>>>>> webapp reload.
>>>>>>
>>>>>> To that end, I wrote a restart() method for the WikiEngine, and  
>>>>>> it
>>>>>> seems to work perfectly except in one respect: I can't figure out
>>>>>> how
>>>>>> to restart the logging subsystem. Any hints? I'd like to be  
>>>>>> able to
>>>>>> allow the admin to specify the desired log file location, and  
>>>>>> after
>>>>>> restart all of the logging is redirected there.
>>>>>>
>>>>>> Actually, there is one more thing: how does one set the Priha  
>>>>>> page
>>>>>> directory? I'm pretty sure there's a setting in priha.properties
>>>>>> that
>>>>>> needs to be set, but I don't know what it is.
>>>>>>
>>>>>> Andrew
>>>>>>
>>>>>
>>>
>>>
>>


Re: Restart logging?

Posted by Harry Metske <ha...@gmail.com>.
Andrew,
see https://issues.apache.org/jira/browse/JSPWIKI-376

We have implemented slf4j to abstract away from specific logging
implementations.
PropertyConfigurator is a log4j specific class, if you would directly use
that class as coded below, you would revert all the effort done in
JSPWIKI-376 and we would rely again on log4j.
What you should at least do is first check if log4j is on the classpath and
then use reflection to get to the PropertyConfigurator. If there is no log4j
on the classpath we should disappoint the user by saying "sorry, no log4j
present, we can't do reconfigure logging right now".
LoggerFactory.registerLoggerMBean does a similar classpath-check/reflection
trick.
If we all think that slf4j abstraction wasn't a good idea because we have
thrown away all the log4j-specific goodies, we should get rid of slf4j
again, thereby reverting JSPWIKI-376. (vote ?)

A sort of meet in the middle might be to only change the log4j.properties
file, and require a webapp reload for the "logging restart" to work.

regards,
Harry

2009/9/7 Andrew Jaquith <an...@gmail.com>

> Ok, I figured it out. Google is my friend. I simply added this to the
> [new] WikiEngine.restart() method:
>
>        LogManager.resetConfiguration();
>        ClassLoader cl = this.getClass().getClassLoader();
>        URL log4jprops = cl.getResource( "log4j.properties" );
>        if (log4jprops != null)
>            PropertyConfigurator.configure(log4jprops);
>
> ...and that's all it took. I'll check this in soon.
>
> Hat-tip goes to Alan Green at bright-green.com. :)
>
> Now, this might not work if somebody swaps out their logging
> configuration, so we might want to add in some safeguards to see if
> Log4j is actually being used. But to Janne's point, this is about the
> first-use experience. Which has now improved dramatically. :)
>
> Andrew
>
> On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
> van<an...@siemens.com> wrote:
> >
> >> Another possibility is to switch to Simple logging, which always goes
> >
> >> to stdout - in Tomcat's case, catalina.out.  Then there would be no
> >> need to provide configuration on Install.jsp, which would simplify our
> >
> >> install process even more.
> >
> > Such simple logging would not give enough control on resource use.
> > It would be better imho to switch to log4j instead.
> >
> > Eventually a reload is shorthand for the sequence shutdown, startup.
> > Logging libraries should give their user control over when the shutdown
> > happens
> > exactly, so I would assume a reload won't be a problem if implemented
> > as a shutdown of the logging subsystem followed by a startup.
> >
> >        regards, Andre
> >
> > -----Original Message-----
> > From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
> > Sent: maandag 7 september 2009 8:26
> > To: jspwiki-dev@incubator.apache.org
> > Subject: Re: Restart logging?
> >
> >
> > I don't think there's a simple way to do that through slf4j, simply
> > because log configuration is very specific to the actual logging
> > library used. For example, java.util.logging has a single global
> > LogManager, and to restart that one would mean writing our own
> > ClassLoader...
> >
> > However, since this is about first-use experience, it's unlikely that
> > someone would both be savvy enough to first switch the logging library
> > - THEN go and apply the easy-install process. So we might get away
> > simply by reconfiguring whichever logging library we happen to be
> > shipping with.
> >
> > Another possibility is to switch to Simple logging, which always goes
> > to stdout - in Tomcat's case, catalina.out.  Then there would be no
> > need to provide configuration on Install.jsp, which would simplify our
> > install process even more.
> >
> > /Janne
> >
> > On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
> >
> >> Hi Harry,
> >>
> >> The idea is to configure the wiki, including logging settings, using
> >> the installer screen. Then, after pressing the "Configure!" button,
> >> presto! the wiki is configured the way it should be without needing to
> >> restart the webapp. Instant gratification! It is much better than
> >> having to restart the webapp.
> >>
> >> Right now, in my local builds, everything *except* the log file change
> >> seems to work fine. The goal is to have the desired log file location
> >> (configured via the installer) reflected immediately -- the logs start
> >> going to that file. So I want to know how best to do that. Whether it
> >> is JMX or whatever, I don't care. But I am not a logging expert; hence
> >> the broadcast. If you have ideas I'd like to hear about them.
> >>
> >> Andrew
> >>
> >> On Sun, Sep 6, 2009 at 12:45 PM, Harry
> >> Metske<ha...@gmail.com> wrote:
> >>> Well,
> >>>
> >>> we have our own logging layer (org.apache.wiki.log) which talks to
> >>> slf4j
> >>> which talks to a real logging implementation (with log4j as the
> >>> default).
> >>> The first two don't have support for configuring logging at all,
> >>> the writer
> >>> of slf4j says you also shouldn't :
> >>> http://www.slf4j.org/faq.html#configure_logging
> >>> Log4j itself does support dynamic configuration of logging, but
> >>> that has
> >>> explicitly not been put in the slf4j interface.
> >>>
> >>> We do however have some way of dynamically configuring our loggers,
> >>> and
> >>> that's through the MBeans (currently you have to use jconsole to do
> >>> it, but
> >>> a nice GUI for it would still be nice). This is however limited.
> >>>
> >>> So with "restart logging" you could something in that direction,
> >>> but again,
> >>> that is limited to log4j, if you run another logging
> >>> implementation, you are
> >>> left alone in the dark.
> >>>
> >>> BTW, what exactly would be the difference between restarting the
> >>> engine and
> >>> reloading the whole webapp ?
> >>>
> >>> regards,
> >>> Harry
> >>>
> >>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
> >>>
> >>>> Hi all --
> >>>>
> >>>> I am doing a bunch of work on the installer/config code. I've
> >>>> already
> >>>> got some really cool features implemented (LDAP config and live
> >>>> testing, Stripesification of the interface, configuration of
> >>>> multiple
> >>>> properties files simultaneously...). One thing I would REALLY like
> >>>> to
> >>>> do is to be able to apply changes to the wiki WITHOUT requiring a
> >>>> webapp reload.
> >>>>
> >>>> To that end, I wrote a restart() method for the WikiEngine, and it
> >>>> seems to work perfectly except in one respect: I can't figure out
> >>>> how
> >>>> to restart the logging subsystem. Any hints? I'd like to be able to
> >>>> allow the admin to specify the desired log file location, and after
> >>>> restart all of the logging is redirected there.
> >>>>
> >>>> Actually, there is one more thing: how does one set the Priha page
> >>>> directory? I'm pretty sure there's a setting in priha.properties
> >>>> that
> >>>> needs to be set, but I don't know what it is.
> >>>>
> >>>> Andrew
> >>>>
> >>>
> >
> >
>

RE: Restart logging?

Posted by "Dalen, Andre van" <an...@siemens.com>.
Something like:?
		// Reconfigure  the logging
		if (null != props && Log4JLogger.class.getName().equals(log.getClass().getName())) {

			PropertyConfigurator.configure(props);
		} 

(where log is your logger instance)
Cleanup on destroy() of the web-app can be done with
		LogFactory.releaseAll();

	regards, Andre

-----Original Message-----
From: Andrew Jaquith [mailto:andrew.r.jaquith@gmail.com] 
Sent: maandag 7 september 2009 13:55
To: jspwiki-dev@incubator.apache.org
Subject: Re: Restart logging?

Ok, I figured it out. Google is my friend. I simply added this to the
[new] WikiEngine.restart() method:

        LogManager.resetConfiguration();
        ClassLoader cl = this.getClass().getClassLoader();
        URL log4jprops = cl.getResource( "log4j.properties" );
        if (log4jprops != null)
            PropertyConfigurator.configure(log4jprops);

...and that's all it took. I'll check this in soon.

Hat-tip goes to Alan Green at bright-green.com. :)

Now, this might not work if somebody swaps out their logging
configuration, so we might want to add in some safeguards to see if
Log4j is actually being used. But to Janne's point, this is about the
first-use experience. Which has now improved dramatically. :)

Andrew

On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
van<an...@siemens.com> wrote:
>
>> Another possibility is to switch to Simple logging, which always goes
>
>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>> need to provide configuration on Install.jsp, which would simplify our
>
>> install process even more.
>
> Such simple logging would not give enough control on resource use.
> It would be better imho to switch to log4j instead.
>
> Eventually a reload is shorthand for the sequence shutdown, startup.
> Logging libraries should give their user control over when the shutdown
> happens
> exactly, so I would assume a reload won't be a problem if implemented
> as a shutdown of the logging subsystem followed by a startup.
>
>        regards, Andre
>
> -----Original Message-----
> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
> Sent: maandag 7 september 2009 8:26
> To: jspwiki-dev@incubator.apache.org
> Subject: Re: Restart logging?
>
>
> I don't think there's a simple way to do that through slf4j, simply
> because log configuration is very specific to the actual logging
> library used. For example, java.util.logging has a single global
> LogManager, and to restart that one would mean writing our own
> ClassLoader...
>
> However, since this is about first-use experience, it's unlikely that
> someone would both be savvy enough to first switch the logging library
> - THEN go and apply the easy-install process. So we might get away
> simply by reconfiguring whichever logging library we happen to be
> shipping with.
>
> Another possibility is to switch to Simple logging, which always goes
> to stdout - in Tomcat's case, catalina.out.  Then there would be no
> need to provide configuration on Install.jsp, which would simplify our
> install process even more.
>
> /Janne
>
> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>
>> Hi Harry,
>>
>> The idea is to configure the wiki, including logging settings, using
>> the installer screen. Then, after pressing the "Configure!" button,
>> presto! the wiki is configured the way it should be without needing to
>> restart the webapp. Instant gratification! It is much better than
>> having to restart the webapp.
>>
>> Right now, in my local builds, everything *except* the log file change
>> seems to work fine. The goal is to have the desired log file location
>> (configured via the installer) reflected immediately -- the logs start
>> going to that file. So I want to know how best to do that. Whether it
>> is JMX or whatever, I don't care. But I am not a logging expert; hence
>> the broadcast. If you have ideas I'd like to hear about them.
>>
>> Andrew
>>
>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>> Metske<ha...@gmail.com> wrote:
>>> Well,
>>>
>>> we have our own logging layer (org.apache.wiki.log) which talks to
>>> slf4j
>>> which talks to a real logging implementation (with log4j as the
>>> default).
>>> The first two don't have support for configuring logging at all,
>>> the writer
>>> of slf4j says you also shouldn't :
>>> http://www.slf4j.org/faq.html#configure_logging
>>> Log4j itself does support dynamic configuration of logging, but
>>> that has
>>> explicitly not been put in the slf4j interface.
>>>
>>> We do however have some way of dynamically configuring our loggers,
>>> and
>>> that's through the MBeans (currently you have to use jconsole to do
>>> it, but
>>> a nice GUI for it would still be nice). This is however limited.
>>>
>>> So with "restart logging" you could something in that direction,
>>> but again,
>>> that is limited to log4j, if you run another logging
>>> implementation, you are
>>> left alone in the dark.
>>>
>>> BTW, what exactly would be the difference between restarting the
>>> engine and
>>> reloading the whole webapp ?
>>>
>>> regards,
>>> Harry
>>>
>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>
>>>> Hi all --
>>>>
>>>> I am doing a bunch of work on the installer/config code. I've
>>>> already
>>>> got some really cool features implemented (LDAP config and live
>>>> testing, Stripesification of the interface, configuration of
>>>> multiple
>>>> properties files simultaneously...). One thing I would REALLY like
>>>> to
>>>> do is to be able to apply changes to the wiki WITHOUT requiring a
>>>> webapp reload.
>>>>
>>>> To that end, I wrote a restart() method for the WikiEngine, and it
>>>> seems to work perfectly except in one respect: I can't figure out
>>>> how
>>>> to restart the logging subsystem. Any hints? I'd like to be able to
>>>> allow the admin to specify the desired log file location, and after
>>>> restart all of the logging is redirected there.
>>>>
>>>> Actually, there is one more thing: how does one set the Priha page
>>>> directory? I'm pretty sure there's a setting in priha.properties
>>>> that
>>>> needs to be set, but I don't know what it is.
>>>>
>>>> Andrew
>>>>
>>>
>
>

Re: Restart logging?

Posted by Andrew Jaquith <an...@gmail.com>.
Ok, I figured it out. Google is my friend. I simply added this to the
[new] WikiEngine.restart() method:

        LogManager.resetConfiguration();
        ClassLoader cl = this.getClass().getClassLoader();
        URL log4jprops = cl.getResource( "log4j.properties" );
        if (log4jprops != null)
            PropertyConfigurator.configure(log4jprops);

...and that's all it took. I'll check this in soon.

Hat-tip goes to Alan Green at bright-green.com. :)

Now, this might not work if somebody swaps out their logging
configuration, so we might want to add in some safeguards to see if
Log4j is actually being used. But to Janne's point, this is about the
first-use experience. Which has now improved dramatically. :)

Andrew

On Mon, Sep 7, 2009 at 5:43 AM, Dalen, Andre
van<an...@siemens.com> wrote:
>
>> Another possibility is to switch to Simple logging, which always goes
>
>> to stdout - in Tomcat's case, catalina.out.  Then there would be no
>> need to provide configuration on Install.jsp, which would simplify our
>
>> install process even more.
>
> Such simple logging would not give enough control on resource use.
> It would be better imho to switch to log4j instead.
>
> Eventually a reload is shorthand for the sequence shutdown, startup.
> Logging libraries should give their user control over when the shutdown
> happens
> exactly, so I would assume a reload won't be a problem if implemented
> as a shutdown of the logging subsystem followed by a startup.
>
>        regards, Andre
>
> -----Original Message-----
> From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com]
> Sent: maandag 7 september 2009 8:26
> To: jspwiki-dev@incubator.apache.org
> Subject: Re: Restart logging?
>
>
> I don't think there's a simple way to do that through slf4j, simply
> because log configuration is very specific to the actual logging
> library used. For example, java.util.logging has a single global
> LogManager, and to restart that one would mean writing our own
> ClassLoader...
>
> However, since this is about first-use experience, it's unlikely that
> someone would both be savvy enough to first switch the logging library
> - THEN go and apply the easy-install process. So we might get away
> simply by reconfiguring whichever logging library we happen to be
> shipping with.
>
> Another possibility is to switch to Simple logging, which always goes
> to stdout - in Tomcat's case, catalina.out.  Then there would be no
> need to provide configuration on Install.jsp, which would simplify our
> install process even more.
>
> /Janne
>
> On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:
>
>> Hi Harry,
>>
>> The idea is to configure the wiki, including logging settings, using
>> the installer screen. Then, after pressing the "Configure!" button,
>> presto! the wiki is configured the way it should be without needing to
>> restart the webapp. Instant gratification! It is much better than
>> having to restart the webapp.
>>
>> Right now, in my local builds, everything *except* the log file change
>> seems to work fine. The goal is to have the desired log file location
>> (configured via the installer) reflected immediately -- the logs start
>> going to that file. So I want to know how best to do that. Whether it
>> is JMX or whatever, I don't care. But I am not a logging expert; hence
>> the broadcast. If you have ideas I'd like to hear about them.
>>
>> Andrew
>>
>> On Sun, Sep 6, 2009 at 12:45 PM, Harry
>> Metske<ha...@gmail.com> wrote:
>>> Well,
>>>
>>> we have our own logging layer (org.apache.wiki.log) which talks to
>>> slf4j
>>> which talks to a real logging implementation (with log4j as the
>>> default).
>>> The first two don't have support for configuring logging at all,
>>> the writer
>>> of slf4j says you also shouldn't :
>>> http://www.slf4j.org/faq.html#configure_logging
>>> Log4j itself does support dynamic configuration of logging, but
>>> that has
>>> explicitly not been put in the slf4j interface.
>>>
>>> We do however have some way of dynamically configuring our loggers,
>>> and
>>> that's through the MBeans (currently you have to use jconsole to do
>>> it, but
>>> a nice GUI for it would still be nice). This is however limited.
>>>
>>> So with "restart logging" you could something in that direction,
>>> but again,
>>> that is limited to log4j, if you run another logging
>>> implementation, you are
>>> left alone in the dark.
>>>
>>> BTW, what exactly would be the difference between restarting the
>>> engine and
>>> reloading the whole webapp ?
>>>
>>> regards,
>>> Harry
>>>
>>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>>
>>>> Hi all --
>>>>
>>>> I am doing a bunch of work on the installer/config code. I've
>>>> already
>>>> got some really cool features implemented (LDAP config and live
>>>> testing, Stripesification of the interface, configuration of
>>>> multiple
>>>> properties files simultaneously...). One thing I would REALLY like
>>>> to
>>>> do is to be able to apply changes to the wiki WITHOUT requiring a
>>>> webapp reload.
>>>>
>>>> To that end, I wrote a restart() method for the WikiEngine, and it
>>>> seems to work perfectly except in one respect: I can't figure out
>>>> how
>>>> to restart the logging subsystem. Any hints? I'd like to be able to
>>>> allow the admin to specify the desired log file location, and after
>>>> restart all of the logging is redirected there.
>>>>
>>>> Actually, there is one more thing: how does one set the Priha page
>>>> directory? I'm pretty sure there's a setting in priha.properties
>>>> that
>>>> needs to be set, but I don't know what it is.
>>>>
>>>> Andrew
>>>>
>>>
>
>

RE: Restart logging?

Posted by "Dalen, Andre van" <an...@siemens.com>.
> Another possibility is to switch to Simple logging, which always goes

> to stdout - in Tomcat's case, catalina.out.  Then there would be no  
> need to provide configuration on Install.jsp, which would simplify our

> install process even more. 

Such simple logging would not give enough control on resource use.
It would be better imho to switch to log4j instead.

Eventually a reload is shorthand for the sequence shutdown, startup.
Logging libraries should give their user control over when the shutdown
happens
exactly, so I would assume a reload won't be a problem if implemented
as a shutdown of the logging subsystem followed by a startup.

	regards, Andre

-----Original Message-----
From: Janne Jalkanen [mailto:janne.jalkanen@ecyrd.com] 
Sent: maandag 7 september 2009 8:26
To: jspwiki-dev@incubator.apache.org
Subject: Re: Restart logging?


I don't think there's a simple way to do that through slf4j, simply  
because log configuration is very specific to the actual logging  
library used. For example, java.util.logging has a single global  
LogManager, and to restart that one would mean writing our own  
ClassLoader...

However, since this is about first-use experience, it's unlikely that  
someone would both be savvy enough to first switch the logging library  
- THEN go and apply the easy-install process. So we might get away  
simply by reconfiguring whichever logging library we happen to be  
shipping with.

Another possibility is to switch to Simple logging, which always goes  
to stdout - in Tomcat's case, catalina.out.  Then there would be no  
need to provide configuration on Install.jsp, which would simplify our  
install process even more.

/Janne

On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:

> Hi Harry,
>
> The idea is to configure the wiki, including logging settings, using
> the installer screen. Then, after pressing the "Configure!" button,
> presto! the wiki is configured the way it should be without needing to
> restart the webapp. Instant gratification! It is much better than
> having to restart the webapp.
>
> Right now, in my local builds, everything *except* the log file change
> seems to work fine. The goal is to have the desired log file location
> (configured via the installer) reflected immediately -- the logs start
> going to that file. So I want to know how best to do that. Whether it
> is JMX or whatever, I don't care. But I am not a logging expert; hence
> the broadcast. If you have ideas I'd like to hear about them.
>
> Andrew
>
> On Sun, Sep 6, 2009 at 12:45 PM, Harry  
> Metske<ha...@gmail.com> wrote:
>> Well,
>>
>> we have our own logging layer (org.apache.wiki.log) which talks to  
>> slf4j
>> which talks to a real logging implementation (with log4j as the  
>> default).
>> The first two don't have support for configuring logging at all,  
>> the writer
>> of slf4j says you also shouldn't :
>> http://www.slf4j.org/faq.html#configure_logging
>> Log4j itself does support dynamic configuration of logging, but  
>> that has
>> explicitly not been put in the slf4j interface.
>>
>> We do however have some way of dynamically configuring our loggers,  
>> and
>> that's through the MBeans (currently you have to use jconsole to do  
>> it, but
>> a nice GUI for it would still be nice). This is however limited.
>>
>> So with "restart logging" you could something in that direction,  
>> but again,
>> that is limited to log4j, if you run another logging  
>> implementation, you are
>> left alone in the dark.
>>
>> BTW, what exactly would be the difference between restarting the  
>> engine and
>> reloading the whole webapp ?
>>
>> regards,
>> Harry
>>
>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>
>>> Hi all --
>>>
>>> I am doing a bunch of work on the installer/config code. I've  
>>> already
>>> got some really cool features implemented (LDAP config and live
>>> testing, Stripesification of the interface, configuration of  
>>> multiple
>>> properties files simultaneously...). One thing I would REALLY like  
>>> to
>>> do is to be able to apply changes to the wiki WITHOUT requiring a
>>> webapp reload.
>>>
>>> To that end, I wrote a restart() method for the WikiEngine, and it
>>> seems to work perfectly except in one respect: I can't figure out  
>>> how
>>> to restart the logging subsystem. Any hints? I'd like to be able to
>>> allow the admin to specify the desired log file location, and after
>>> restart all of the logging is redirected there.
>>>
>>> Actually, there is one more thing: how does one set the Priha page
>>> directory? I'm pretty sure there's a setting in priha.properties  
>>> that
>>> needs to be set, but I don't know what it is.
>>>
>>> Andrew
>>>
>>


Re: Restart logging?

Posted by Janne Jalkanen <ja...@ecyrd.com>.
I don't think there's a simple way to do that through slf4j, simply  
because log configuration is very specific to the actual logging  
library used. For example, java.util.logging has a single global  
LogManager, and to restart that one would mean writing our own  
ClassLoader...

However, since this is about first-use experience, it's unlikely that  
someone would both be savvy enough to first switch the logging library  
- THEN go and apply the easy-install process. So we might get away  
simply by reconfiguring whichever logging library we happen to be  
shipping with.

Another possibility is to switch to Simple logging, which always goes  
to stdout - in Tomcat's case, catalina.out.  Then there would be no  
need to provide configuration on Install.jsp, which would simplify our  
install process even more.

/Janne

On 7 Sep 2009, at 00:52, Andrew Jaquith wrote:

> Hi Harry,
>
> The idea is to configure the wiki, including logging settings, using
> the installer screen. Then, after pressing the "Configure!" button,
> presto! the wiki is configured the way it should be without needing to
> restart the webapp. Instant gratification! It is much better than
> having to restart the webapp.
>
> Right now, in my local builds, everything *except* the log file change
> seems to work fine. The goal is to have the desired log file location
> (configured via the installer) reflected immediately -- the logs start
> going to that file. So I want to know how best to do that. Whether it
> is JMX or whatever, I don't care. But I am not a logging expert; hence
> the broadcast. If you have ideas I'd like to hear about them.
>
> Andrew
>
> On Sun, Sep 6, 2009 at 12:45 PM, Harry  
> Metske<ha...@gmail.com> wrote:
>> Well,
>>
>> we have our own logging layer (org.apache.wiki.log) which talks to  
>> slf4j
>> which talks to a real logging implementation (with log4j as the  
>> default).
>> The first two don't have support for configuring logging at all,  
>> the writer
>> of slf4j says you also shouldn't :
>> http://www.slf4j.org/faq.html#configure_logging
>> Log4j itself does support dynamic configuration of logging, but  
>> that has
>> explicitly not been put in the slf4j interface.
>>
>> We do however have some way of dynamically configuring our loggers,  
>> and
>> that's through the MBeans (currently you have to use jconsole to do  
>> it, but
>> a nice GUI for it would still be nice). This is however limited.
>>
>> So with "restart logging" you could something in that direction,  
>> but again,
>> that is limited to log4j, if you run another logging  
>> implementation, you are
>> left alone in the dark.
>>
>> BTW, what exactly would be the difference between restarting the  
>> engine and
>> reloading the whole webapp ?
>>
>> regards,
>> Harry
>>
>> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>>
>>> Hi all --
>>>
>>> I am doing a bunch of work on the installer/config code. I've  
>>> already
>>> got some really cool features implemented (LDAP config and live
>>> testing, Stripesification of the interface, configuration of  
>>> multiple
>>> properties files simultaneously...). One thing I would REALLY like  
>>> to
>>> do is to be able to apply changes to the wiki WITHOUT requiring a
>>> webapp reload.
>>>
>>> To that end, I wrote a restart() method for the WikiEngine, and it
>>> seems to work perfectly except in one respect: I can't figure out  
>>> how
>>> to restart the logging subsystem. Any hints? I'd like to be able to
>>> allow the admin to specify the desired log file location, and after
>>> restart all of the logging is redirected there.
>>>
>>> Actually, there is one more thing: how does one set the Priha page
>>> directory? I'm pretty sure there's a setting in priha.properties  
>>> that
>>> needs to be set, but I don't know what it is.
>>>
>>> Andrew
>>>
>>


Re: Restart logging?

Posted by Andrew Jaquith <an...@gmail.com>.
Hi Harry,

The idea is to configure the wiki, including logging settings, using
the installer screen. Then, after pressing the "Configure!" button,
presto! the wiki is configured the way it should be without needing to
restart the webapp. Instant gratification! It is much better than
having to restart the webapp.

Right now, in my local builds, everything *except* the log file change
seems to work fine. The goal is to have the desired log file location
(configured via the installer) reflected immediately -- the logs start
going to that file. So I want to know how best to do that. Whether it
is JMX or whatever, I don't care. But I am not a logging expert; hence
the broadcast. If you have ideas I'd like to hear about them.

Andrew

On Sun, Sep 6, 2009 at 12:45 PM, Harry Metske<ha...@gmail.com> wrote:
> Well,
>
> we have our own logging layer (org.apache.wiki.log) which talks to slf4j
> which talks to a real logging implementation (with log4j as the default).
> The first two don't have support for configuring logging at all, the writer
> of slf4j says you also shouldn't :
> http://www.slf4j.org/faq.html#configure_logging
> Log4j itself does support dynamic configuration of logging, but that has
> explicitly not been put in the slf4j interface.
>
> We do however have some way of dynamically configuring our loggers, and
> that's through the MBeans (currently you have to use jconsole to do it, but
> a nice GUI for it would still be nice). This is however limited.
>
> So with "restart logging" you could something in that direction, but again,
> that is limited to log4j, if you run another logging implementation, you are
> left alone in the dark.
>
> BTW, what exactly would be the difference between restarting the engine and
> reloading the whole webapp ?
>
> regards,
> Harry
>
> 2009/9/6 Andrew Jaquith <an...@gmail.com>
>
>> Hi all --
>>
>> I am doing a bunch of work on the installer/config code. I've already
>> got some really cool features implemented (LDAP config and live
>> testing, Stripesification of the interface, configuration of multiple
>> properties files simultaneously...). One thing I would REALLY like to
>> do is to be able to apply changes to the wiki WITHOUT requiring a
>> webapp reload.
>>
>> To that end, I wrote a restart() method for the WikiEngine, and it
>> seems to work perfectly except in one respect: I can't figure out how
>> to restart the logging subsystem. Any hints? I'd like to be able to
>> allow the admin to specify the desired log file location, and after
>> restart all of the logging is redirected there.
>>
>> Actually, there is one more thing: how does one set the Priha page
>> directory? I'm pretty sure there's a setting in priha.properties that
>> needs to be set, but I don't know what it is.
>>
>> Andrew
>>
>

Re: Restart logging?

Posted by Harry Metske <ha...@gmail.com>.
Well,

we have our own logging layer (org.apache.wiki.log) which talks to slf4j
which talks to a real logging implementation (with log4j as the default).
The first two don't have support for configuring logging at all, the writer
of slf4j says you also shouldn't :
http://www.slf4j.org/faq.html#configure_logging
Log4j itself does support dynamic configuration of logging, but that has
explicitly not been put in the slf4j interface.

We do however have some way of dynamically configuring our loggers, and
that's through the MBeans (currently you have to use jconsole to do it, but
a nice GUI for it would still be nice). This is however limited.

So with "restart logging" you could something in that direction, but again,
that is limited to log4j, if you run another logging implementation, you are
left alone in the dark.

BTW, what exactly would be the difference between restarting the engine and
reloading the whole webapp ?

regards,
Harry

2009/9/6 Andrew Jaquith <an...@gmail.com>

> Hi all --
>
> I am doing a bunch of work on the installer/config code. I've already
> got some really cool features implemented (LDAP config and live
> testing, Stripesification of the interface, configuration of multiple
> properties files simultaneously...). One thing I would REALLY like to
> do is to be able to apply changes to the wiki WITHOUT requiring a
> webapp reload.
>
> To that end, I wrote a restart() method for the WikiEngine, and it
> seems to work perfectly except in one respect: I can't figure out how
> to restart the logging subsystem. Any hints? I'd like to be able to
> allow the admin to specify the desired log file location, and after
> restart all of the logging is redirected there.
>
> Actually, there is one more thing: how does one set the Priha page
> directory? I'm pretty sure there's a setting in priha.properties that
> needs to be set, but I don't know what it is.
>
> Andrew
>

Re: Restart logging?

Posted by Janne Jalkanen <ja...@ecyrd.com>.
Be careful of mem leaks...
priha.provider.defaultProvider.directory=/tmp/priha/
/janne

On 6 Sep 2009, at 17:12, Andrew Jaquith wrote:

> Hi all --
>
> I am doing a bunch of work on the installer/config code. I've already
> got some really cool features implemented (LDAP config and live
> testing, Stripesification of the interface, configuration of multiple
> properties files simultaneously...). One thing I would REALLY like to
> do is to be able to apply changes to the wiki WITHOUT requiring a
> webapp reload.
>
> To that end, I wrote a restart() method for the WikiEngine, and it
> seems to work perfectly except in one respect: I can't figure out how
> to restart the logging subsystem. Any hints? I'd like to be able to
> allow the admin to specify the desired log file location, and after
> restart all of the logging is redirected there.
>
> Actually, there is one more thing: how does one set the Priha page
> directory? I'm pretty sure there's a setting in priha.properties that
> needs to be set, but I don't know what it is.
>
> Andrew