Tomcat 8.5 RequestDumperFilter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tomcat 8.5 RequestDumperFilter

Wolfeman
Hi,
I am trying to debug some requests coming into an application we have
running on tomcat. I was hoping to be able to print all of the request data
specifically post data to a debug file and this seemed like a good
solution. However I have followed the tomcat documentation for tomcat 7 and
tomcat 8, which is basically the same.

I added the following to logging.properties
handlers = 1catalina.org.apache.juli.AsyncFileHandler,
2localhost.org.apache.juli.AsyncFileHandler,
3manager.org.apache.juli.AsyncFileHandler,
4host-manager.org.apache.juli.AsyncFileHandler,
java.util.logging.ConsoleHandler,
5request-dumper.org.apache.juli.FileHandler

# To this configuration >elow, 1request-dumper.org.apache.juli.FileHandler
# also -eeds to be added to the handlers property near the top of the file
5request-dumper.org.apache.juli.FileHandler.level = INFO
5request-dumper.org.apache.juli.FileHandler.directory =
${catalina.base}/logs
5request-dumper.org.apache.juli.FileHandler.prefix = request-dumper.
5request-dumper.org.apache.juli.FileHandler.encoding = UTF-8
5request-dumper.org.apache.juli.FileHandler.formatter =
org.apache.juli.VerbatimFormatter

org.apache.catalina.filters.RequestDumperFilter.level = INFO
org.apache.catalina.filters.RequestDumperFilter.handlers =
5request-dumper.org.apache.juli.FileHandler

And I added this to the both the web.xml in the conf directory and the
web.xml in my application. I tried one, the other and both at the same time.

<filter>
    <filter-name>requestdumper</filter-name>
    <filter-class>
        org.apache.catalina.filters.RequestDumperFilter
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>requestdumper</filter-name>
    <url-pattern>*</url-pattern>
</filter-mapping>


When I start tomcat it creates the log file, however nothing ever gets
printed in it. So it isn't working. I must be missing something. Is this
the right way to do this?

--
Thanks,
Brian Wolfe
https://www.linkedin.com/in/brian-wolfe-3136425a/
Reply | Threaded
Open this post in threaded view
|

Re: Tomcat 8.5 RequestDumperFilter

Christopher Schultz-2
Wolfeman,

On 10/8/20 10:33, Wolfeman wrote:

> Hi,
> I am trying to debug some requests coming into an application we have
> running on tomcat. I was hoping to be able to print all of the request data
> specifically post data to a debug file and this seemed like a good
> solution. However I have followed the tomcat documentation for tomcat 7 and
> tomcat 8, which is basically the same.
>
> I added the following to logging.properties
> handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> 2localhost.org.apache.juli.AsyncFileHandler,
> 3manager.org.apache.juli.AsyncFileHandler,
> 4host-manager.org.apache.juli.AsyncFileHandler,
> java.util.logging.ConsoleHandler,
> 5request-dumper.org.apache.juli.FileHandler
>
> # To this configuration >elow, 1request-dumper.org.apache.juli.FileHandler
> # also -eeds to be added to the handlers property near the top of the file
> 5request-dumper.org.apache.juli.FileHandler.level = INFO
> 5request-dumper.org.apache.juli.FileHandler.directory =
> ${catalina.base}/logs
> 5request-dumper.org.apache.juli.FileHandler.prefix = request-dumper.
> 5request-dumper.org.apache.juli.FileHandler.encoding = UTF-8
> 5request-dumper.org.apache.juli.FileHandler.formatter =
> org.apache.juli.VerbatimFormatter
>
> org.apache.catalina.filters.RequestDumperFilter.level = INFO
> org.apache.catalina.filters.RequestDumperFilter.handlers =
> 5request-dumper.org.apache.juli.FileHandler
>
> And I added this to the both the web.xml in the conf directory and the
> web.xml in my application. I tried one, the other and both at the same time.

Definitely remove everything you added from conf/web.xml. That will be a
disaster.

> <filter>
>     <filter-name>requestdumper</filter-name>
>     <filter-class>
>         org.apache.catalina.filters.RequestDumperFilter
>     </filter-class>
> </filter>
> <filter-mapping>
>     <filter-name>requestdumper</filter-name>
>     <url-pattern>*</url-pattern>
> </filter-mapping>
>
>
> When I start tomcat it creates the log file, however nothing ever gets
> printed in it. So it isn't working. I must be missing something. Is this
> the right way to do this?

What if you use "/*" as your url-pattern instead of "*"?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Tomcat 8.5 RequestDumperFilter

Wolfeman
Ok I was able to get it to work for one of the example apps. I must have a
conflicting filter in the we app i'm trying to diagnose.

On Thu, Oct 8, 2020 at 3:03 PM Christopher Schultz <
[hidden email]> wrote:

> Wolfeman,
>
> On 10/8/20 10:33, Wolfeman wrote:
> > Hi,
> > I am trying to debug some requests coming into an application we have
> > running on tomcat. I was hoping to be able to print all of the request
> data
> > specifically post data to a debug file and this seemed like a good
> > solution. However I have followed the tomcat documentation for tomcat 7
> and
> > tomcat 8, which is basically the same.
> >
> > I added the following to logging.properties
> > handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> > 2localhost.org.apache.juli.AsyncFileHandler,
> > 3manager.org.apache.juli.AsyncFileHandler,
> > 4host-manager.org.apache.juli.AsyncFileHandler,
> > java.util.logging.ConsoleHandler,
> > 5request-dumper.org.apache.juli.FileHandler
> >
> > # To this configuration >elow,
> 1request-dumper.org.apache.juli.FileHandler
> > # also -eeds to be added to the handlers property near the top of the
> file
> > 5request-dumper.org.apache.juli.FileHandler.level = INFO
> > 5request-dumper.org.apache.juli.FileHandler.directory =
> > ${catalina.base}/logs
> > 5request-dumper.org.apache.juli.FileHandler.prefix = request-dumper.
> > 5request-dumper.org.apache.juli.FileHandler.encoding = UTF-8
> > 5request-dumper.org.apache.juli.FileHandler.formatter =
> > org.apache.juli.VerbatimFormatter
> >
> > org.apache.catalina.filters.RequestDumperFilter.level = INFO
> > org.apache.catalina.filters.RequestDumperFilter.handlers =
> > 5request-dumper.org.apache.juli.FileHandler
> >
> > And I added this to the both the web.xml in the conf directory and the
> > web.xml in my application. I tried one, the other and both at the same
> time.
>
> Definitely remove everything you added from conf/web.xml. That will be a
> disaster.
>
> > <filter>
> >     <filter-name>requestdumper</filter-name>
> >     <filter-class>
> >         org.apache.catalina.filters.RequestDumperFilter
> >     </filter-class>
> > </filter>
> > <filter-mapping>
> >     <filter-name>requestdumper</filter-name>
> >     <url-pattern>*</url-pattern>
> > </filter-mapping>
> >
> >
> > When I start tomcat it creates the log file, however nothing ever gets
> > printed in it. So it isn't working. I must be missing something. Is this
> > the right way to do this?
>
> What if you use "/*" as your url-pattern instead of "*"?
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Thanks,
Brian Wolfe
https://www.linkedin.com/in/brian-wolfe-3136425a/