You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Mik <mi...@gmail.com> on 2010/08/30 13:47:05 UTC
XML Log4j configuration
Hi all.
It it possible to configure Geronimo server so that it will utilize log4j
XML configuration instead of the default server-log4j.properties?
I would really like to use the level filter option in XML configuration, but
still would like to have logging configured on server level...
Thanks.
--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/XML-Log4j-configuration-tp1388271p1388271.html
Sent from the Users mailing list archive at Nabble.com.
Re: XML Log4j configuration
Posted by chi runhua <ch...@gmail.com>.
Hi Mik, thanks a lot for contributing back to the community.
I've put the How-to information in G2.2 document at
https://cwiki.apache.org/GMOxDOC22/configuring-application-specific-logging-with-log4j.html
<https://cwiki.apache.org/GMOxDOC22/configuring-application-specific-logging-with-log4j.html>
Jeff
On Tue, Aug 31, 2010 at 9:37 PM, Kevan Miller <ke...@gmail.com>wrote:
>
> On Aug 31, 2010, at 8:27 AM, Mik wrote:
>
> >
> > Hi Kevan
> >
> > Thanks for your reply. Looking through the code in Log4jService.java made
> > the difference..
> >
> > // Allow users to override the configurationFile which is hardcoded
> > // in config.ser and cannot be updated by config.xml, as the
> > // AttrbiuteManager comes up after this GBean
> > String cfgFile = System
> > .getProperty(LOG4JSERVICE_CONFIG_PROPERTY);
> > if ((cfgFile != null) && (!cfgFile.equals(""))) {
> > this .configurationFile = cfgFile;
> > }
> >
> > So the config file value can be overridden at server startup by using
> > org.apache.geronimo.log4jservice.configuration system property, and it
> also
> > seems to accept the xml format :-)
>
> Hi Mik,
> Great. Good work digging through the source!. Forgot that this GBean
> attribute couldn't be overridden... Normally, the config.xml override would
> work. As indicated by above comment, this is an edge case due to order of
> server startup...
>
> --kevan
>
>
Re: XML Log4j configuration
Posted by Kevan Miller <ke...@gmail.com>.
On Aug 31, 2010, at 8:27 AM, Mik wrote:
>
> Hi Kevan
>
> Thanks for your reply. Looking through the code in Log4jService.java made
> the difference..
>
> // Allow users to override the configurationFile which is hardcoded
> // in config.ser and cannot be updated by config.xml, as the
> // AttrbiuteManager comes up after this GBean
> String cfgFile = System
> .getProperty(LOG4JSERVICE_CONFIG_PROPERTY);
> if ((cfgFile != null) && (!cfgFile.equals(""))) {
> this .configurationFile = cfgFile;
> }
>
> So the config file value can be overridden at server startup by using
> org.apache.geronimo.log4jservice.configuration system property, and it also
> seems to accept the xml format :-)
Hi Mik,
Great. Good work digging through the source!. Forgot that this GBean attribute couldn't be overridden... Normally, the config.xml override would work. As indicated by above comment, this is an edge case due to order of server startup...
--kevan
Re: XML Log4j configuration
Posted by Mik <mi...@gmail.com>.
Hi Kevan
Thanks for your reply. Looking through the code in Log4jService.java made
the difference..
// Allow users to override the configurationFile which is hardcoded
// in config.ser and cannot be updated by config.xml, as the
// AttrbiuteManager comes up after this GBean
String cfgFile = System
.getProperty(LOG4JSERVICE_CONFIG_PROPERTY);
if ((cfgFile != null) && (!cfgFile.equals(""))) {
this .configurationFile = cfgFile;
}
So the config file value can be overridden at server startup by using
org.apache.geronimo.log4jservice.configuration system property, and it also
seems to accept the xml format :-)
Thanks once again.
Regards Mik
--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/XML-Log4j-configuration-tp1388271p1393987.html
Sent from the Users mailing list archive at Nabble.com.
Re: XML Log4j configuration
Posted by Kevan Miller <ke...@gmail.com>.
On Aug 30, 2010, at 1:51 PM, Mik wrote:
>
> Thanks - already been there.
>
> Does not solve my problem :-(
>
> Basically what I'm after is to configure server logging to use log4j.xml
> instead of log4j.properties (server-log4j.properties)
>
> I did already try to define a file called log4j.xml & server-log4j.xml, both
> without any luck.
Hi Mik,
The Logger GBean configures the location of the log4j configuration file for the Geronimo server. I don't know that anyone has ever tried it, but there is some code which seems to accommodate a .xml file. So, if you're willing to test it out, try the following...
Edit var/config/config.xml, locate the j2ee-system <module> and replace with something like the following (I'm assuming 2.2, adjust your version numbers appropriately):
<module name="org.apache.geronimo.framework/j2ee-system/2.2/car">
<gbean name="Logger">
<attribute name="configFileName">var/log/server-log4j.xml</attribute>
</gbean>
</module>
If that doesn't work, you can look at the following to see what might be going wrong:
geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/URLConfigurator.java
geronimo/server/branches/2.2/framework/configs/j2ee-system/src/main/plan/plan.xml
--kevan
Re: XML Log4j configuration
Posted by Mik <mi...@gmail.com>.
Thanks - already been there.
Does not solve my problem :-(
Basically what I'm after is to configure server logging to use log4j.xml
instead of log4j.properties (server-log4j.properties)
I did already try to define a file called log4j.xml & server-log4j.xml, both
without any luck.
--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/XML-Log4j-configuration-tp1388271p1389968.html
Sent from the Users mailing list archive at Nabble.com.
Re: XML Log4j configuration
Posted by chi runhua <ch...@gmail.com>.
see if the page could do any help.
https://cwiki.apache.org/GMOxDOC22/configuring-application-specific-logging-with-log4j.html
<https://cwiki.apache.org/GMOxDOC22/configuring-application-specific-logging-with-log4j.html>
Jeff
On Mon, Aug 30, 2010 at 7:47 PM, Mik <mi...@gmail.com> wrote:
>
> Hi all.
>
> It it possible to configure Geronimo server so that it will utilize log4j
> XML configuration instead of the default server-log4j.properties?
>
> I would really like to use the level filter option in XML configuration,
> but
> still would like to have logging configured on server level...
>
> Thanks.
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/XML-Log4j-configuration-tp1388271p1388271.html
> Sent from the Users mailing list archive at Nabble.com.
>