You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Dariusz Łuksza <da...@gmail.com> on 2009/04/25 19:52:17 UTC
[c3-monitoring] Logging reconfiguration.
Hi all,
I'm actually starting work on my GSoC project so in near feature you
will be getting a lot of spam from me and Jira ;)
First goal that I want to achieve is logging reconfiguration (I'm sure
that you all ready notice corresponding with it mail from Jira).
I've all read attach small patch to jira issue that adds
cocoon-monitoring module but I have also one question connected with
this patch.
I'm not quite sure what should I do witch "old"
cocoon-configuration-api and cocoon-spring-configurator. Should I :
[1] add dependency to cocoon-monitoring on cocoon-configuration-api
or cocoon-spring-configurator,
[2] create another solution based on cocoon-spring-configurator
[3] integrate both project and add it to c3
?
I've notice that now in c3 there no division between api and it's
implementation, so I think that first approach wouldn't be good. IMHO
the best solution would be implementing logging reconfiguration from
scratch based on code from cocoon-spring-configurator.
I'm looking froward for yours advices and opinions ;)
--
Best regards
Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza
Re: [c3-monitoring] Logging reconfiguration.
Posted by Reinhard Pötz <re...@apache.org>.
Dariusz Łuksza wrote:
> On Thu, May 14, 2009 at 10:55 AM, Reinhard Pötz <re...@apache.org> wrote:
>>> I know that in my application I meniton about usage doc's, but I don't
>>> know exaclty where I can put it. Should I add new wiki page or attach
>>> usage doc to cocoon-monitoring module ?
>> Please add your documentation to
>> http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml
>>
>
> In attachment is my final patch for reconfiguration part (with full
> javadoc and usage doc). It contains also changes from my previous
> patch with some minor changes in formatting and fixes for miss
> spelling.
I applied your patch, both the code and also the documentation with some
minor modifications.
Great work, keep it up!
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member reinhard@apache.org
________________________________________________________________________
Re: [c3-monitoring] Logging reconfiguration.
Posted by Dariusz Łuksza <da...@gmail.com>.
On Thu, May 14, 2009 at 10:55 AM, Reinhard Pötz <re...@apache.org> wrote:
>> I know that in my application I meniton about usage doc's, but I don't
>> know exaclty where I can put it. Should I add new wiki page or attach
>> usage doc to cocoon-monitoring module ?
>
> Please add your documentation to
> http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml
>
In attachment is my final patch for reconfiguration part (with full
javadoc and usage doc). It contains also changes from my previous
patch with some minor changes in formatting and fixes for miss
spelling.
--
Best regards
Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza
Re: [c3-monitoring] Logging reconfiguration.
Posted by Reinhard Pötz <re...@apache.org>.
Dariusz Łuksza wrote:
> On Sat, May 9, 2009 at 11:48 AM, Reinhard Pötz <re...@apache.org> wrote:
>> Great, I'm looking forward to seeing these new features being implemented.
>>
>
> And here it is implemented ;)
great! I'll look into your patch some time later this week.
> This patch adds only one public method with is responsible for
> handling configuration changes. It supports both XML and properties
> file. In both cases all logging output files are checked for being
> accessible. XML configuration is validated against xml schema or DTD,
> properties file is checked for containing configuration for at least
> one appender.
>
> Right now there are no javadoc's I'll add them till Wednesday.
>
> I know that in my application I meniton about usage doc's, but I don't
> know exaclty where I can put it. Should I add new wiki page or attach
> usage doc to cocoon-monitoring module ?
Please add your documentation to
http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml
You can build the docs yourself by running 'mvn site' from the
cocoon-docs module base directory.
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member reinhard@apache.org
________________________________________________________________________
Re: [c3-monitoring] Logging reconfiguration.
Posted by Dariusz Łuksza <da...@gmail.com>.
On Sat, May 9, 2009 at 11:48 AM, Reinhard Pötz <re...@apache.org> wrote:
>
> Great, I'm looking forward to seeing these new features being implemented.
>
And here it is implemented ;)
This patch adds only one public method with is responsible for
handling configuration changes. It supports both XML and properties
file. In both cases all logging output files are checked for being
accessible. XML configuration is validated against xml schema or DTD,
properties file is checked for containing configuration for at least
one appender.
Right now there are no javadoc's I'll add them till Wednesday.
I know that in my application I meniton about usage doc's, but I don't
know exaclty where I can put it. Should I add new wiki page or attach
usage doc to cocoon-monitoring module ?
--
Best regards
Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza
Re: [c3-monitoring] Logging reconfiguration.
Posted by Reinhard Pötz <re...@apache.org>.
Dariusz Łuksza wrote:
> 2009/5/5 Dariusz Łuksza <da...@gmail.com>:
>> I think that I'll tomorrow switch to SVN and I'll resend patches ...
>>
>
> OK, I switch to SVN and now I can provide TortoiseSVN compatible patches ;)
>
> I've already notice that you somehow apply my first patch from jira, I
> hope that it wasn't relay hard to do that ;)
no, your second patch worked fine for me.
> In attach is a preview patch of logging configuration (generated by
> svn ;)).
I've applied your patch with some minor changes:
. I changed the class names from being verbs to nouns
. I prefer using the group name as part of bean ids
. minor reformatting (variable names, using 'this')
> In few next days I'll provide rest of logging reconfiguration
> feature, it will be "reloading configuration file". I think that there
> would be two methods for that, one for properties and one for XML
> file. Before load that file in to log4j there would be some
> validation. First it would be a simple validation that would check
> that configuration file exist and is readable if everything goes OK,
> next would be more complex specialized for properties like files and
> XML files.
Great, I'm looking forward to seeing these new features being implemented.
> For properties files it would check, that at least one appender is
> defined. I don't know that it is enough for prevent of having log4j
> unconfigured.
>
> Validation of XML files would be more simple because it would be check
> that configuration matches to log4j XML configuration schema.
>
> Any more ideas ?
Your ideas sound good to me, nothing to add at the moment.
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member reinhard@apache.org
________________________________________________________________________
Re: [c3-monitoring] Logging reconfiguration.
Posted by Dariusz Łuksza <da...@gmail.com>.
2009/5/5 Dariusz Łuksza <da...@gmail.com>:
>
> I think that I'll tomorrow switch to SVN and I'll resend patches ...
>
OK, I switch to SVN and now I can provide TortoiseSVN compatible patches ;)
I've already notice that you somehow apply my first patch from jira, I
hope that it wasn't relay hard to do that ;)
In attach is a preview patch of logging configuration (generated by
svn ;)). In few next days I'll provide rest of logging reconfiguration
feature, it will be "reloading configuration file". I think that there
would be two methods for that, one for properties and one for XML
file. Before load that file in to log4j there would be some
validation. First it would be a simple validation that would check
that configuration file exist and is readable if everything goes OK,
next would be more complex specialized for properties like files and
XML files.
For properties files it would check, that at least one appender is
defined. I don't know that it is enough for prevent of having log4j
unconfigured.
Validation of XML files would be more simple because it would be check
that configuration matches to log4j XML configuration schema.
Any more ideas ?
BTW. Greetings from Kraków and GeeCON ;) ... Maybe someone form Cocoon
community is also here ?
--
Best regards
Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza
Re: [c3-monitoring] Logging reconfiguration.
Posted by Dariusz Łuksza <da...@gmail.com>.
On Tue, May 5, 2009 at 9:35 PM, Reinhard Pötz <re...@apache.org> wrote:
>
> I've tried to apply your patch but it's a git patch and not a unified diff.
OK, so it looks like I must switch to SVN ... I done that after I get
better internet connection
> > btw. Is there any possibility to write junit test for that functionalities ?
>
> good question. Maybe we can provide some integration tests but this
> seems to be difficult too.
IMHO, we can check that we don't apply improper settings ;)
> > In future this code could be moved to cocoon-spring-configurator project.
> >
> > It is only my proposition how this fictionally could be implemented.
> >
> > WDYT ?
>
> More feedback as soon as I can apply your patch.
>
I think that I'll tomorrow switch to SVN and I'll resend patches ...
--
Best regards
Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza
Re: [c3-monitoring] Logging reconfiguration.
Posted by Reinhard Pötz <re...@apache.org>.
Dariusz Łuksza wrote:
> 2009/4/25 Dariusz Łuksza <dariusz.luksza@gmail.com
> <ma...@gmail.com>>:
>> I'm not quite sure what should I do witch "old"
>> cocoon-configuration-api and cocoon-spring-configurator. Should I :
>> [1] add dependency to cocoon-monitoring on cocoon-configuration-api
>> or cocoon-spring-configurator,
>> [2] create another solution based on cocoon-spring-configurator
>> [3] integrate both project and add it to c3
>> ?
>
> For now I've decided that I'll user directly LogRepository log4j to
> achieve reconfiguration of logging level for single class or package.
>
> First milestone in logging reconfiguration via JMX would be adding
> possibility of (permanent or temporal) change log level for single
> package or class.
>
> To achieve that I implemented two class (Log4JReconfigure and
> RestoreLoggingConfiguration) and added cocoon-monitoring.xml for
> spring-jmx configuration.
>
> So first class (Log4JReconfigure) is an MBean that would be exposed on
> JXM service. It has 3 public methods :
> * getLoggers - returns all configured loggers with their logging level
> * setLoggingLevel - this method set logging level for permanent (if
> logger already exist it will only change logging level in other case it
> will create logger with that level)
> * setLoggingTempoporalLevel - change logging level or single class or
> package only some time and then log level is set back to old value
> Second class (RestoreLoggingConfiguration) is used only
> in setLoggingTempoporalLevel method and it performs restore old config
> after specified time (it use Timer class inside ;))
> Full sources of this classes are in attachment, for proper work you will
> need new-cocoon-monitoring-module2.patch from COCOON3-33 jira issue.
I've tried to apply your patch but it's a git patch and not a unified diff.
> btw. Is there any possibility to write junit test for that functionalities ?
good question. Maybe we can provide some integration tests but this
seems to be difficult too.
> In future this code could be moved to cocoon-spring-configurator project.
>
> It is only my proposition how this fictionally could be implemented.
>
> WDYT ?
More feedback as soon as I can apply your patch.
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member reinhard@apache.org
________________________________________________________________________
Fwd: [c3-monitoring] Logging reconfiguration.
Posted by Dariusz Łuksza <da...@gmail.com>.
2009/4/25 Dariusz Łuksza <da...@gmail.com>:
> I'm not quite sure what should I do witch "old"
> cocoon-configuration-api and cocoon-spring-configurator. Should I :
> [1] add dependency to cocoon-monitoring on cocoon-configuration-api
> or cocoon-spring-configurator,
> [2] create another solution based on cocoon-spring-configurator
> [3] integrate both project and add it to c3
> ?
For now I've decided that I'll user directly LogRepository log4j to achieve
reconfiguration of logging level for single class or package.
First milestone in logging reconfiguration via JMX would be adding
possibility of (permanent or temporal) change log level for single package
or class.
To achieve that I implemented two class (Log4JReconfigure and
RestoreLoggingConfiguration) and added cocoon-monitoring.xml for spring-jmx
configuration.
So first class (Log4JReconfigure) is an MBean that would be exposed on JXM
service. It has 3 public methods :
* getLoggers - returns all configured loggers with their logging level
* setLoggingLevel - this method set logging level for permanent (if logger
already exist it will only change logging level in other case it will create
logger with that level)
* setLoggingTempoporalLevel - change logging level or single class or
package only some time and then log level is set back to old value
Second class (RestoreLoggingConfiguration) is used only
in setLoggingTempoporalLevel method and it performs restore old config after
specified time (it use Timer class inside ;))
Full sources of this classes are in attachment, for proper work you will
need new-cocoon-monitoring-module2.patch from COCOON3-33 jira issue.
btw. Is there any possibility to write junit test for that functionalities ?
In future this code could be moved to cocoon-spring-configurator project.
It is only my proposition how this fictionally could be implemented.
WDYT ?
--
Best regards
Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza