You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Dave Brondsema <da...@brondsema.net> on 2004/07/15 19:59:14 UTC
JCS logging
We at Forrest are seeing more JCS log messages than we want. I tried
setting up a log4j.properties file to control it, but that didn't seem to
work. At any rate, it looks like they're using commons logging now, so
according to
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108665505130942&w=2 it
can be controlled with LogKit by cocoon. Could somebody do this?
Thanks!
--
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
http://csx.calvin.edu : student org
Re: JCS logging
Posted by David Crossley <cr...@apache.org>.
Vadim Gritsenko wrote:
> Dave Brondsema wrote:
> >Dave Brondsema wrote:
> >
> >>We at Forrest are seeing more JCS log messages than we want. I tried
> >>setting up a log4j.properties file to control it, but that didn't seem to
> >>work. At any rate, it looks like they're using commons logging now, so
> >>according to
> >>http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108665505130942&w=2 it
> >>can be controlled with LogKit by cocoon. Could somebody do this?
> >>
> >Since nobody is eager to do this, could give me some guidance so I can do
> >it myself? What files would I have to edit? How does logkit work in
> >cocon?
>
> If you declare system variable:
>
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
> commons logging will use LogKit. See web.xml, force-property parameter.
> LogKit is set up by CocoonServlet.
>
> Hope this helps you,
Perhaps this too:
http://wiki.apache.org/cocoon/ExploringTheLogs
http://wiki.apache.org/cocoon/ConfiguringTheLogs
--
David Crossley
Re: JCS logging
Posted by Dave Brondsema <da...@brondsema.net>.
On Thu, 22 Jul 2004, Upayavira wrote:
> Dave Brondsema wrote:
>
> > Upayavira wrote:
> >
> >>The CLI way would be to add a property tag into the cli.xconf. Now, this
> >>would be a pretty trivial fix to one Cocoon class. Is this what would be
> >>needed?
> >>
> >>
> >Sounds like it to me. Can we try it?
> >
> >
> Don't have time to do _any_ testing on this (shouldn't really have been
> doing this little bit). Here's a patch for
> o.a.c.bean.helpers.BeanConfigurator.
>
> Try this. This should mean that you can put <system-property name="blah"
> value="diblah"/> into cli.xconf. If it works, either commit it if you
> can, or tell me and I will.
>
> (watch out for the email wrapped line!)
>
> Regards, Upayavira
>
I tried it, but we're using 2.1.5 and are close to making a release, so I
didn't want to go through the trouble of updating everything to use the
latest Cocoon. So I was going to apply your patch to 2.1.5, but then I
realized I can just add
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
when launching the JVM.
So, thanks for the patch, but I don't think it's needed. Using a
commandline parameter works without having to update or modify Cocoon.
And I updated the JCSLogging page on the wiki.
Thanks, guys!
--
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
http://csx.calvin.edu : student org
Re: JCS logging
Posted by Upayavira <uv...@upaya.co.uk>.
Dave Brondsema wrote:
> Upayavira wrote:
>
>>The CLI way would be to add a property tag into the cli.xconf. Now, this
>>would be a pretty trivial fix to one Cocoon class. Is this what would be
>>needed?
>>
>>
>Sounds like it to me. Can we try it?
>
>
Don't have time to do _any_ testing on this (shouldn't really have been
doing this little bit). Here's a patch for
o.a.c.bean.helpers.BeanConfigurator.
Try this. This should mean that you can put <system-property name="blah"
value="diblah"/> into cli.xconf. If it works, either commit it if you
can, or tell me and I will.
(watch out for the email wrapped line!)
Regards, Upayavira
Index: src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java,v
retrieving revision 1.8
diff -u -r1.8 BeanConfigurator.java
--- src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java 28
Mar 2004 20:51:24 -0000 1.8
+++ src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java 22
Jul 2004 14:00:01 -0000
@@ -90,6 +90,9 @@
private static final String ATTR_URI_SOURCEURI = "src";
private static final String ATTR_URI_DESTURI = "dest";
+ private static final String NODE_SYSPROP = "system-property";
+ private static final String ATTR_SYSPROP_NAME = "name";
+ private static final String ATTR_SYSPROP_VALUE = "value";
private static final String NODE_URIS = "uris";
private static final String ATTR_NAME = "name";
@@ -213,6 +216,9 @@
} else if (nodeName.equals(NODE_URIS)) {
parseURIsNode(cocoon, node, destDir, uriGroup);
+ } else if (nodeName.equals(NODE_SYSPROP)) {
+ parsePropertyNode(cocoon, node);
+
} else if (nodeName.equals(NODE_URI_FILE)) {
if (hasAttribute(root, ATTR_URI_FILE)) {
throw new IllegalArgumentException("Cannot have
"+NODE_URI_FILE+" as both element and attribute");
@@ -241,6 +247,20 @@
if (nodes.getLength()!=0) {
throw new IllegalArgumentException("Unexpected children of
<" + NODE_LOGGING + "> node");
}
+ }
+
+ private static void parsePropertyNode(CocoonBean cocoon, Node node)
throws IllegalArgumentException {
+ NodeList nodes = node.getChildNodes();
+ if (nodes.getLength()!=0) {
+ throw new IllegalArgumentException("Unexpected children of
<" + NODE_LOGGING + "> node");
+ }
+ if (!hasAttribute(node, ATTR_SYSPROP_NAME) ||
!hasAttribute(node, ATTR_SYSPROP_VALUE)) {
+ throw new IllegalArgumentException("A property node
requires both name and value attributes");
+ }
+ String name = getAttributeValue(node, ATTR_SYSPROP_NAME);
+ String value = getAttributeValue(node, ATTR_SYSPROP_VALUE);
+
+ System.setProperty(name, value);
}
private static void parseIncludeLinksNode(CocoonBean cocoon, Node
node) throws IllegalArgumentException {
Re: JCS logging
Posted by Dave Brondsema <da...@brondsema.net>.
On Thu, 22 Jul 2004, Upayavira wrote:
> Vadim Gritsenko wrote:
>
> > Dave Brondsema wrote:
> >
> >> On Thu, 15 Jul 2004, Dave Brondsema wrote:
> >>
> >>
> >>> We at Forrest are seeing more JCS log messages than we want. I tried
> >>> setting up a log4j.properties file to control it, but that didn't
> >>> seem to
> >>> work. At any rate, it looks like they're using commons logging now, so
> >>> according to
> >>> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108665505130942&w=2 it
> >>> can be controlled with LogKit by cocoon. Could somebody do this?
> >>>
> >>>
> >>
> >> Since nobody is eager to do this, could give me some guidance so I
> >> can do
> >> it myself? What files would I have to edit? How does logkit work in
> >> cocon?
> >>
> >
> > If you declare system variable:
> >
> > org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
> >
> > commons logging will use LogKit. See web.xml, force-property
> > parameter. LogKit is set up by CocoonServlet.
>
> Are you suggesting setting this property in web.xml? Well, as Forrest
> uses the CLI, they won't use a web.xml.
>
That works for when we run as a webapp. Thanks.
> The CLI way would be to add a property tag into the cli.xconf. Now, this
> would be a pretty trivial fix to one Cocoon class. Is this what would be
> needed?
>
Sounds like it to me. Can we try it?
--
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
http://csx.calvin.edu : student org
Re: JCS logging
Posted by Upayavira <uv...@upaya.co.uk>.
Vadim Gritsenko wrote:
> Dave Brondsema wrote:
>
>> On Thu, 15 Jul 2004, Dave Brondsema wrote:
>>
>>
>>> We at Forrest are seeing more JCS log messages than we want. I tried
>>> setting up a log4j.properties file to control it, but that didn't
>>> seem to
>>> work. At any rate, it looks like they're using commons logging now, so
>>> according to
>>> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108665505130942&w=2 it
>>> can be controlled with LogKit by cocoon. Could somebody do this?
>>>
>>>
>>
>> Since nobody is eager to do this, could give me some guidance so I
>> can do
>> it myself? What files would I have to edit? How does logkit work in
>> cocon?
>>
>
> If you declare system variable:
>
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
>
> commons logging will use LogKit. See web.xml, force-property
> parameter. LogKit is set up by CocoonServlet.
Are you suggesting setting this property in web.xml? Well, as Forrest
uses the CLI, they won't use a web.xml.
The CLI way would be to add a property tag into the cli.xconf. Now, this
would be a pretty trivial fix to one Cocoon class. Is this what would be
needed?
Regards, Upayavira
Re: JCS logging
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Vadim Gritsenko wrote:
> Leszek Gawron wrote:
>
>> Vadim Gritsenko wrote:
>>
>>> If you declare system variable:
>>>
>>> org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
>>>
>>> commons logging will use LogKit. See web.xml, force-property
>>> parameter. LogKit is set up by CocoonServlet.
>>
>>
>> Why isn't this a default setting (at least for cocoon.bat servlet) ?
>
>
>
> Tomcat itself also uses commons logging somewhere, and system variables
> are, well, system-wide - they affect all applications, including tomcat
> itself and all other deployed web applications. Setting of this
> parameter then results in weird behavior of logging in tomcat / other
> applications.
maybe we should at least wikify it.
--
Leszek Gawron lgawron@mobilebox.pl
Project Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: JCS logging
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Leszek Gawron wrote:
> Vadim Gritsenko wrote:
>
>> If you declare system variable:
>>
>> org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
>>
>> commons logging will use LogKit. See web.xml, force-property
>> parameter. LogKit is set up by CocoonServlet.
>
> Why isn't this a default setting (at least for cocoon.bat servlet) ?
Tomcat itself also uses commons logging somewhere, and system variables
are, well, system-wide - they affect all applications, including tomcat
itself and all other deployed web applications. Setting of this
parameter then results in weird behavior of logging in tomcat / other
applications.
Vadim
Re: JCS logging
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Vadim Gritsenko wrote:
> If you declare system variable:
>
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
> commons logging will use LogKit. See web.xml, force-property parameter.
> LogKit is set up by CocoonServlet.
Why isn't this a default setting (at least for cocoon.bat servlet) ?
--
Leszek Gawron lgawron@mobilebox.pl
Project Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: JCS logging
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Dave Brondsema wrote:
>On Thu, 15 Jul 2004, Dave Brondsema wrote:
>
>
>>We at Forrest are seeing more JCS log messages than we want. I tried
>>setting up a log4j.properties file to control it, but that didn't seem to
>>work. At any rate, it looks like they're using commons logging now, so
>>according to
>>http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108665505130942&w=2 it
>>can be controlled with LogKit by cocoon. Could somebody do this?
>>
>>
>>
>Since nobody is eager to do this, could give me some guidance so I can do
>it myself? What files would I have to edit? How does logkit work in
>cocon?
>
If you declare system variable:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
commons logging will use LogKit. See web.xml, force-property parameter.
LogKit is set up by CocoonServlet.
Hope this helps you,
Vadim
Re: JCS logging
Posted by Dave Brondsema <da...@brondsema.net>.
On Thu, 15 Jul 2004, Dave Brondsema wrote:
>
> We at Forrest are seeing more JCS log messages than we want. I tried
> setting up a log4j.properties file to control it, but that didn't seem to
> work. At any rate, it looks like they're using commons logging now, so
> according to
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108665505130942&w=2 it
> can be controlled with LogKit by cocoon. Could somebody do this?
>
> Thanks!
>
Since nobody is eager to do this, could give me some guidance so I can do
it myself? What files would I have to edit? How does logkit work in
cocon?
--
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
http://csx.calvin.edu : student org