Re: Why org.apache.tomcat.util.threads.TaskQueue#offer doesn't have synchronized modifier?

2022-04-25 Thread zrlw
a large number of http requests: 400+

Re: Conditional access logs

2022-04-25 Thread Chris Cheshire



> On Apr 22, 2022, at 1:32 PM, Tim Funk  wrote:
> 
> I don't think there is a technical reason why it couldn't be added. I think
> the hard part is getting the config wording/naming correct
> 
> Alternatively, I think an out of the box workaround could also be Tomcat's
> RewriteValve where the condition matches on header and sets the
> "environment variable"
> https://tomcat.apache.org/tomcat-9.0-doc/rewrite.html
> 
> You can submit a feature enhancement request in the bug database
> https://tomcat.apache.org/bugreport.html#How_to_submit_patches_and_enhancement_requests
> 
> -Tim


Good to know. I’m going to try the logback route first - if that fails I’ll 
look at an enhancement request or patch.

Chris


> 
> 
>> On Thu, Apr 21, 2022 at 5:08 PM Chris Cheshire  wrote:
>> 
>> Tomcat 9.
>> 
>> I wanted to separate out access logs for external api calls to log
>> different info than the standard access log line. For example, the api key
>> used which is set as a request header.
>> 
>> Adding that to the pattern was easy.
>> 
>> However the conditional logging was clunky. I found the ‘conditionIf’ and
>> ‘conditionUnless’ attributes for the access log valve, but these only work
>> on request attributes, not headers (at least that’s what the documentation
>> says).
>> 
>> I have created a filter that copies the values from the request headers to
>> equivalent  attributes, just so the condition can work. This is where it
>> feels  clunky, especially since the access log valve has replacement
>> parameters for logging request headers.
>> 
>> Is there a technical reason why the condition checking can’t work on
>> request headers in the valve? If not, can this be considered as a feature
>> request please?
>> 
>> 
>> 

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Conditional access logs

2022-04-25 Thread Chris Cheshire



> On Apr 22, 2022, at 7:21 PM, Aleks  wrote:
> 
> Hi.
> 
>> On Thu, 21 Apr 2022 17:07:27 -0400
>> Chris Cheshire  wrote:
>> 
>> Tomcat 9.
>> 
>> I wanted to separate out access logs for external api calls to log different
>> info than the standard access log line. For example, the api key used which
>> is set as a request header.
>> 
>> Adding that to the pattern was easy. 
>> 
>> However the conditional logging was clunky. I found the ‘conditionIf’ and
>> ‘conditionUnless’ attributes for the access log valve, but these only work on
>> request attributes, not headers (at least that’s what the documentation 
>> says).
>> 
>> I have created a filter that copies the values from the request headers to
>> equivalent  attributes, just so the condition can work. This is where it
>> feels  clunky, especially since the access log valve has replacement
>> parameters for logging request headers.
> 
> I have solved a similar issue with https://logback.qos.ch/access.html and
> https://logback.qos.ch/manual/loggingSeparation.html
> 
> That's the relevant snipplet for logback-access.xml. It uses the powerful
> filter feature from logback https://logback.qos.ch/manual/filters.html .
> 
> I attach the configmap definition which shows the whole config.
> 
> ```
>  
>
>
>  
>
>  if(event.getRequestURI().contains("/health"))
>return true;
>  return false;
>
>  
>  DENY
>
> ```
> 
> The log back access filter can be used to filter based on some AccessEvent 
> like
> a request header.
> 
> https://logback.qos.ch/manual/filters.html#access_EvalutorFilter
> https://logback.qos.ch/xref/ch/qos/logback/access/spi/AccessEvent.html
> 
> I think that you can also define based on the request header which logger
> should be used but I never had such a requirement .
> 
> Just replace the tomcat access valve with the logback one.
> 
> ```
> quiet="false" filename="conf/logback-access.xml"/>
> ```
> 
> It was required to add this lib to the ext dir of tomcat.
> Maybe there are some newer versions available.
> 
> ```
> ls -1 /opt/apache/tomcat/base/lib/ext/
> commons-compiler-3.1.3.jar
> jackson-annotations-2.9.9.jar
> jackson-core-2.9.9.jar
> jackson-databind-2.9.9.3.jar
> janino-3.1.3.jar
> logback-access-1.2.3.jar
> logback-core-1.2.3.jar
> logstash-logback-encoder-6.6.jar
> 
> ```
> 
>> Is there a technical reason why the condition checking can’t work on request
>> headers in the valve? If not, can this be considered as a feature request
>> please?
>> 
>> Thanks
> 
> 
> Regards
> Alex


Thanks, I’ll take a look at this. I already use logback for the app logging so 
this is familiar. I forgot they even had an access logger.

Chris
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Supporting languages

2022-04-25 Thread Christopher Schultz

M. Alghwell,

On 4/20/22 15:02, M. Osama Alghwell wrote:
I have an Oracle application and database. I am using Tomcat 9 but 
unfortunately Arabic language couldn't be used.


Why not? What are you trying to do (specifically) and what happens when 
you try doing that?



Any help?
This probably has nothing to do with Tomcat, which just pushed bytes 
around for you. In order to support Arabic, you will need to make sure 
that your database tables have been defined in such a way as to accept 
Arabic characters (probably some kind of Unicode encoding) as well as 
configuring your application (and Tomcat) to use something other than 
the (HTTP) protocol-defined default of ISO-8859-1.


I highly recommend reading this:
https://cwiki.apache.org/confluence/x/liklBg

-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Why org.apache.tomcat.util.threads.TaskQueue#offer doesn't have synchronized modifier?

2022-04-25 Thread Christopher Schultz

To whom it may concern.

On 4/21/22 01:50, z...@sina.com wrote:

TaskQueue extendsLinkedBlockingQueue and most calls to
TaskQueue.offer end up callingsuper.offer which provides the
necessary thread-safety.


2. the issue is that TaskQueue.offer return false directly instead of
calling supper.offer when huge requests (more than maximum pool size,
but current pool size is less than max) arrived at the same time.
Can you please explain what you mean by "huge requests"? Do you mean "a 
large number of requests" or "requests with large payloads"? (Or both?)


What is the behavior you are observing? Tomcat performance drops? 
Requests are ignored/stalled?


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 10 and Java 17

2022-04-25 Thread Mark Thomas

On 25/04/2022 08:18, Navin Chandra Mohan wrote:

Hi Mark

Thanks for the input, based on the comments, we tried to update the Java
version to 17, but we are facing conflict during compilation, error shown
below . We have multiple modules using Tomcat in the existing Java 8 setup.

* "The package org.apache.catalina.startup is accessible from more than one
module: org.apache.tomcat.catalina, tomcat.bootstrap*

*import org.apache.catalina.startup.Tomcat"*

Can this be handled moving to Tomcat 10 or 10.1


If you are embedding Tomcat in your application then use the embedded 
JARs. If you aren't embedding Tomcat, you shouldn't be referencing the 
Tomcat JARs in your compilation.


Mark




Thanks

Navin
On Mon, Apr 4, 2022 at 8:31 PM Mark Thomas  wrote:



4 Apr 2022 16:09:21 Navin Chandra Mohan :




1. Is there a recommended version of Tomcat for Java 17. Tomcat 10 or
the
10.1 (once it is released) or I can continue with the 9.0.60 release
itself?


Latest stable release of any currently supported Tomcat branch.


2. Once 10.1 is formally released, will all the common bug fixes be
available in Tomcat 9 and10 as well or at least in 10.


Yes. And in 8.5.x

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 10 and Java 17

2022-04-25 Thread Navin Chandra Mohan
Hi Mark

Thanks for the input, based on the comments, we tried to update the Java
version to 17, but we are facing conflict during compilation, error shown
below . We have multiple modules using Tomcat in the existing Java 8 setup.

* "The package org.apache.catalina.startup is accessible from more than one
module: org.apache.tomcat.catalina, tomcat.bootstrap*

*import org.apache.catalina.startup.Tomcat"*

Can this be handled moving to Tomcat 10 or 10.1


Thanks

Navin
On Mon, Apr 4, 2022 at 8:31 PM Mark Thomas  wrote:

>
> 4 Apr 2022 16:09:21 Navin Chandra Mohan :
>
> 
>
> > 1. Is there a recommended version of Tomcat for Java 17. Tomcat 10 or
> > the
> > 10.1 (once it is released) or I can continue with the 9.0.60 release
> > itself?
>
> Latest stable release of any currently supported Tomcat branch.
>
> > 2. Once 10.1 is formally released, will all the common bug fixes be
> > available in Tomcat 9 and10 as well or at least in 10.
>
> Yes. And in 8.5.x
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>