You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Russell E Glaue <rg...@cait.org> on 2008/12/03 22:44:26 UTC

How to set up logging for a connector

Using geronimo-jetty 2.1.3

I create a new HTTPSelectChannelConnector on port 21050
Suppose I deploy 20 to 30 different web applications to this connector.

Then I want to log all activity through that connector to a certain log file,
and not the default jetty_yyyy_mm_dd.log file, but a new
projectXX_yyyy_mm_dd.log file.

How do I do this?


I have attempted to start configuring Geronimo using the NCSARequestLog gbean,
but I am getting an initialization error (pasted below) on Geronimo start up,
erroring on doStart().

I cannot find any written documentation on how to change the log file output for
a connector. I have read how to change the log file for an individual web
application, but I do not want to do that. I want to change the log file on the
connector level.


    <module name="org.apache.geronimo.configs/jetty6/2.1.3/car">
        ...
        <gbean
name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
gbeanInfo="org.apache.geronimo.jetty6.requestlog.NCSARequestLog">
            <attribute name="filename">var/log/projectXX_yyyy_mm_dd.log</attribute>
            <attribute name="logDateFormat">dd/MMM/yyyy:HH:mm:ss ZZZ</attribute>
            <attribute name="logTimeZone">GMT</attribute>
            <attribute name="retainDays">30</attribute>
            <attribute name="extended">true</attribute>
            <attribute name="append">true</attribute>
            <reference name="JettyContainer">
                <pattern>
                    <groupId>org.apache.geronimo.configs</groupId>
                    <artifactId>jetty6</artifactId>
                    <version>2.1.3</version>
                    <type>car</type>
                    <name>JettyWebContainer</name>
                </pattern>
            </reference>
            <reference name="ServerInfo"/>
        </gbean>
        <gbean
name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=project-XX"
gbeanInfo="org.apache.geronimo.jetty6.connector.HTTPSelectChannelConnector">
            <attribute name="port">21050</attribute>
            <attribute name="bufferSizeBytes">8096</attribute>
            <attribute name="host">0.0.0.0</attribute>
            <attribute name="lingerMillis">-1</attribute>
            <attribute name="redirectPort">0</attribute>
            <attribute name="maxThreads">50</attribute>
            <attribute name="acceptQueueSize">0</attribute>
            <attribute name="headerBufferSizeBytes">8192</attribute>
            <reference name="JettyContainer">
                <pattern>
                    <groupId>org.apache.geronimo.configs</groupId>
                    <artifactId>jetty6</artifactId>
                    <version>2.1.3</version>
                    <type>car</type>
                    <name>JettyWebContainer</name>
                </pattern>
            </reference>
        </gbean>
        ...
    </module>


Error message on Geronimo startup with above configuration:
--
Module 24/67 org.apache.geronimo.configs/j2ee-corba-yoko/2.1.3/car
  started in  1.558s
Module 25/67 org.apache.geronimo.configs/jetty6/2.1.3/car
 15:27:20,161 ERROR [GBeanInstanceState] Error while starting; GBean is now in
the FAILED state:
abstractName="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
java.lang.NullPointerException
        at
org.apache.geronimo.jetty6.requestlog.NCSARequestLog.doStart(NCSARequestLog.java:113)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
        at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
        at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
        at
org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
        at
org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
        at
org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
        at
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
--



Re: How to set up logging for a connector

Posted by Russell E Glaue <rg...@cait.org>.
The solution for this is discussed in the thread user@geronimo.apache.org
"feature? ContainerGroup" 12/05/2008 09:46 AM.

The solution requires deploying a new jetty container via a gbean, and also
deploying a new NCSARequestLog gbean.


I have entered a feature request into the Jetty project's issue system.

http://jira.codehaus.org/browse/JETTY-835

This feature request is to implement a new RequestLog that does more than
file-based logging. The suggestion has been to use slf4j in the new
implementation, which in turn will support sending logs to Socket, Syslog, and
will in turn support log4j.

-RG


Russell E Glaue wrote:
> Is it possible to configure a separate logging for different virtual hosts I
> configure?
> 
> Say I configure the vhost of "www.example.com" and I want to log all traffic
> going to that vhost in a log file "var/log/www.example.com_yyy_mm_dd.log"
> 
> I can deploy a web application to a virtual host I define in the
> geronimo-web.xml file.
> 
> Can I also setup logging based on virtual hosts?
> 
> -RG
> 
> 
> 
> Jarek Gawor wrote:
>> I'm not sure how to do what you want (you might need to write some
>> custom code) but you should be able to get rid of that NPE by changing
>> the following:
>>
>>  <reference name="ServerInfo"/>
>>
>> to:
>>
>>  <reference name="ServerInfo">
>>      <name>ServerInfo</name>
>>  </reference>
>>
>> in your RequestLog gbean.
>>
>> Jarek
>>
>> On Wed, Dec 3, 2008 at 4:44 PM, Russell E Glaue <rg...@cait.org> wrote:
>>> Using geronimo-jetty 2.1.3
>>>
>>> I create a new HTTPSelectChannelConnector on port 21050
>>> Suppose I deploy 20 to 30 different web applications to this connector.
>>>
>>> Then I want to log all activity through that connector to a certain log file,
>>> and not the default jetty_yyyy_mm_dd.log file, but a new
>>> projectXX_yyyy_mm_dd.log file.
>>>
>>> How do I do this?
>>>
>>>
>>> I have attempted to start configuring Geronimo using the NCSARequestLog gbean,
>>> but I am getting an initialization error (pasted below) on Geronimo start up,
>>> erroring on doStart().
>>>
>>> I cannot find any written documentation on how to change the log file output for
>>> a connector. I have read how to change the log file for an individual web
>>> application, but I do not want to do that. I want to change the log file on the
>>> connector level.
>>>
>>>
>>>    <module name="org.apache.geronimo.configs/jetty6/2.1.3/car">
>>>        ...
>>>        <gbean
>>> name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
>>> gbeanInfo="org.apache.geronimo.jetty6.requestlog.NCSARequestLog">
>>>            <attribute name="filename">var/log/projectXX_yyyy_mm_dd.log</attribute>
>>>            <attribute name="logDateFormat">dd/MMM/yyyy:HH:mm:ss ZZZ</attribute>
>>>            <attribute name="logTimeZone">GMT</attribute>
>>>            <attribute name="retainDays">30</attribute>
>>>            <attribute name="extended">true</attribute>
>>>            <attribute name="append">true</attribute>
>>>            <reference name="JettyContainer">
>>>                <pattern>
>>>                    <groupId>org.apache.geronimo.configs</groupId>
>>>                    <artifactId>jetty6</artifactId>
>>>                    <version>2.1.3</version>
>>>                    <type>car</type>
>>>                    <name>JettyWebContainer</name>
>>>                </pattern>
>>>            </reference>
>>>            <reference name="ServerInfo"/>
>>>        </gbean>
>>>        <gbean
>>> name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=project-XX"
>>> gbeanInfo="org.apache.geronimo.jetty6.connector.HTTPSelectChannelConnector">
>>>            <attribute name="port">21050</attribute>
>>>            <attribute name="bufferSizeBytes">8096</attribute>
>>>            <attribute name="host">0.0.0.0</attribute>
>>>            <attribute name="lingerMillis">-1</attribute>
>>>            <attribute name="redirectPort">0</attribute>
>>>            <attribute name="maxThreads">50</attribute>
>>>            <attribute name="acceptQueueSize">0</attribute>
>>>            <attribute name="headerBufferSizeBytes">8192</attribute>
>>>            <reference name="JettyContainer">
>>>                <pattern>
>>>                    <groupId>org.apache.geronimo.configs</groupId>
>>>                    <artifactId>jetty6</artifactId>
>>>                    <version>2.1.3</version>
>>>                    <type>car</type>
>>>                    <name>JettyWebContainer</name>
>>>                </pattern>
>>>            </reference>
>>>        </gbean>
>>>        ...
>>>    </module>
>>>
>>>
>>> Error message on Geronimo startup with above configuration:
>>> --
>>> Module 24/67 org.apache.geronimo.configs/j2ee-corba-yoko/2.1.3/car
>>>  started in  1.558s
>>> Module 25/67 org.apache.geronimo.configs/jetty6/2.1.3/car
>>>  15:27:20,161 ERROR [GBeanInstanceState] Error while starting; GBean is now in
>>> the FAILED state:
>>> abstractName="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
>>> java.lang.NullPointerException
>>>        at
>>> org.apache.geronimo.jetty6.requestlog.NCSARequestLog.doStart(NCSARequestLog.java:113)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
>>>        at
>>> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
>>> --
>>>
>>>
>>>
> 


Re: How to set up logging for a connector

Posted by Russell E Glaue <rg...@cait.org>.
Is it possible to configure a separate logging for different virtual hosts I
configure?

Say I configure the vhost of "www.example.com" and I want to log all traffic
going to that vhost in a log file "var/log/www.example.com_yyy_mm_dd.log"

I can deploy a web application to a virtual host I define in the
geronimo-web.xml file.

Can I also setup logging based on virtual hosts?

-RG



Jarek Gawor wrote:
> I'm not sure how to do what you want (you might need to write some
> custom code) but you should be able to get rid of that NPE by changing
> the following:
> 
>  <reference name="ServerInfo"/>
> 
> to:
> 
>  <reference name="ServerInfo">
>      <name>ServerInfo</name>
>  </reference>
> 
> in your RequestLog gbean.
> 
> Jarek
> 
> On Wed, Dec 3, 2008 at 4:44 PM, Russell E Glaue <rg...@cait.org> wrote:
>> Using geronimo-jetty 2.1.3
>>
>> I create a new HTTPSelectChannelConnector on port 21050
>> Suppose I deploy 20 to 30 different web applications to this connector.
>>
>> Then I want to log all activity through that connector to a certain log file,
>> and not the default jetty_yyyy_mm_dd.log file, but a new
>> projectXX_yyyy_mm_dd.log file.
>>
>> How do I do this?
>>
>>
>> I have attempted to start configuring Geronimo using the NCSARequestLog gbean,
>> but I am getting an initialization error (pasted below) on Geronimo start up,
>> erroring on doStart().
>>
>> I cannot find any written documentation on how to change the log file output for
>> a connector. I have read how to change the log file for an individual web
>> application, but I do not want to do that. I want to change the log file on the
>> connector level.
>>
>>
>>    <module name="org.apache.geronimo.configs/jetty6/2.1.3/car">
>>        ...
>>        <gbean
>> name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
>> gbeanInfo="org.apache.geronimo.jetty6.requestlog.NCSARequestLog">
>>            <attribute name="filename">var/log/projectXX_yyyy_mm_dd.log</attribute>
>>            <attribute name="logDateFormat">dd/MMM/yyyy:HH:mm:ss ZZZ</attribute>
>>            <attribute name="logTimeZone">GMT</attribute>
>>            <attribute name="retainDays">30</attribute>
>>            <attribute name="extended">true</attribute>
>>            <attribute name="append">true</attribute>
>>            <reference name="JettyContainer">
>>                <pattern>
>>                    <groupId>org.apache.geronimo.configs</groupId>
>>                    <artifactId>jetty6</artifactId>
>>                    <version>2.1.3</version>
>>                    <type>car</type>
>>                    <name>JettyWebContainer</name>
>>                </pattern>
>>            </reference>
>>            <reference name="ServerInfo"/>
>>        </gbean>
>>        <gbean
>> name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=project-XX"
>> gbeanInfo="org.apache.geronimo.jetty6.connector.HTTPSelectChannelConnector">
>>            <attribute name="port">21050</attribute>
>>            <attribute name="bufferSizeBytes">8096</attribute>
>>            <attribute name="host">0.0.0.0</attribute>
>>            <attribute name="lingerMillis">-1</attribute>
>>            <attribute name="redirectPort">0</attribute>
>>            <attribute name="maxThreads">50</attribute>
>>            <attribute name="acceptQueueSize">0</attribute>
>>            <attribute name="headerBufferSizeBytes">8192</attribute>
>>            <reference name="JettyContainer">
>>                <pattern>
>>                    <groupId>org.apache.geronimo.configs</groupId>
>>                    <artifactId>jetty6</artifactId>
>>                    <version>2.1.3</version>
>>                    <type>car</type>
>>                    <name>JettyWebContainer</name>
>>                </pattern>
>>            </reference>
>>        </gbean>
>>        ...
>>    </module>
>>
>>
>> Error message on Geronimo startup with above configuration:
>> --
>> Module 24/67 org.apache.geronimo.configs/j2ee-corba-yoko/2.1.3/car
>>  started in  1.558s
>> Module 25/67 org.apache.geronimo.configs/jetty6/2.1.3/car
>>  15:27:20,161 ERROR [GBeanInstanceState] Error while starting; GBean is now in
>> the FAILED state:
>> abstractName="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
>> java.lang.NullPointerException
>>        at
>> org.apache.geronimo.jetty6.requestlog.NCSARequestLog.doStart(NCSARequestLog.java:113)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
>>        at
>> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
>> --
>>
>>
>>


Re: How to set up logging for a connector

Posted by Jarek Gawor <jg...@gmail.com>.
I'm not sure how to do what you want (you might need to write some
custom code) but you should be able to get rid of that NPE by changing
the following:

 <reference name="ServerInfo"/>

to:

 <reference name="ServerInfo">
     <name>ServerInfo</name>
 </reference>

in your RequestLog gbean.

Jarek

On Wed, Dec 3, 2008 at 4:44 PM, Russell E Glaue <rg...@cait.org> wrote:
> Using geronimo-jetty 2.1.3
>
> I create a new HTTPSelectChannelConnector on port 21050
> Suppose I deploy 20 to 30 different web applications to this connector.
>
> Then I want to log all activity through that connector to a certain log file,
> and not the default jetty_yyyy_mm_dd.log file, but a new
> projectXX_yyyy_mm_dd.log file.
>
> How do I do this?
>
>
> I have attempted to start configuring Geronimo using the NCSARequestLog gbean,
> but I am getting an initialization error (pasted below) on Geronimo start up,
> erroring on doStart().
>
> I cannot find any written documentation on how to change the log file output for
> a connector. I have read how to change the log file for an individual web
> application, but I do not want to do that. I want to change the log file on the
> connector level.
>
>
>    <module name="org.apache.geronimo.configs/jetty6/2.1.3/car">
>        ...
>        <gbean
> name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
> gbeanInfo="org.apache.geronimo.jetty6.requestlog.NCSARequestLog">
>            <attribute name="filename">var/log/projectXX_yyyy_mm_dd.log</attribute>
>            <attribute name="logDateFormat">dd/MMM/yyyy:HH:mm:ss ZZZ</attribute>
>            <attribute name="logTimeZone">GMT</attribute>
>            <attribute name="retainDays">30</attribute>
>            <attribute name="extended">true</attribute>
>            <attribute name="append">true</attribute>
>            <reference name="JettyContainer">
>                <pattern>
>                    <groupId>org.apache.geronimo.configs</groupId>
>                    <artifactId>jetty6</artifactId>
>                    <version>2.1.3</version>
>                    <type>car</type>
>                    <name>JettyWebContainer</name>
>                </pattern>
>            </reference>
>            <reference name="ServerInfo"/>
>        </gbean>
>        <gbean
> name="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=project-XX"
> gbeanInfo="org.apache.geronimo.jetty6.connector.HTTPSelectChannelConnector">
>            <attribute name="port">21050</attribute>
>            <attribute name="bufferSizeBytes">8096</attribute>
>            <attribute name="host">0.0.0.0</attribute>
>            <attribute name="lingerMillis">-1</attribute>
>            <attribute name="redirectPort">0</attribute>
>            <attribute name="maxThreads">50</attribute>
>            <attribute name="acceptQueueSize">0</attribute>
>            <attribute name="headerBufferSizeBytes">8192</attribute>
>            <reference name="JettyContainer">
>                <pattern>
>                    <groupId>org.apache.geronimo.configs</groupId>
>                    <artifactId>jetty6</artifactId>
>                    <version>2.1.3</version>
>                    <type>car</type>
>                    <name>JettyWebContainer</name>
>                </pattern>
>            </reference>
>        </gbean>
>        ...
>    </module>
>
>
> Error message on Geronimo startup with above configuration:
> --
> Module 24/67 org.apache.geronimo.configs/j2ee-corba-yoko/2.1.3/car
>  started in  1.558s
> Module 25/67 org.apache.geronimo.configs/jetty6/2.1.3/car
>  15:27:20,161 ERROR [GBeanInstanceState] Error while starting; GBean is now in
> the FAILED state:
> abstractName="org.apache.geronimo.configs/jetty6/2.1.3/car?ServiceModule=org.apache.geronimo.configs/jetty6/2.1.3/car,j2eeType=GBean,name=RequestLog"
> java.lang.NullPointerException
>        at
> org.apache.geronimo.jetty6.requestlog.NCSARequestLog.doStart(NCSARequestLog.java:113)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
>        at
> org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
>        at
> org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
>        at
> org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
>        at
> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
> --
>
>
>