Re: Question about the log variable in Filters

2022-08-31 Thread tianshuang
Well, actually the Filter class will only be loaded once by the common 
classloader, to ensure that the latest log configuration in the webapp is used, 
we have to remove the static modifier to ensure that the log instance is 
recreated with the new configuration (if the configuration changes).

Thanks,
tianshuang

> On Aug 31, 2022, at 18:52, Konstantin Kolinko  wrote:
> 
> ср, 31 авг. 2022 г. в 13:25, tianshuang :
>> 
>> Hi,
>> 
>> In this commit 
>> <https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e>,
>>  the static modifier was removed from the log variable in the Filters class, 
>> but I don't understand why it needs to be removed. As far as I know, when a 
>> class is loaded by different classLoader, each classLoader creates its own 
>> instance of static variable. So, is it necessary to remove the static 
>> modifier here?
>> 
>> commit url: 
>> https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e
> 
> See classloader hierarchy here:
> 
> https://tomcat.apache.org/tomcat-10.1-doc/class-loader-howto.html
> https://tomcat.apache.org/tomcat-8.5-doc/class-loader-howto.html
> 
> When Webapp classloader loads the Filter class, it does not "load the
> class" (i.e. does not read the bytes from a jar archive and does not
> produce a Class out of those bytes). It delegates the task to its
> parent in the classloader hierarchy. Thus, the Filter class is loaded
> by the Common classloader.
> 
> At the same time, the logging configuration for each web application
> may be different:
> A web application may provide its own copy of logging.properties file
> by placing it into its own WEB-INF/classes/ directory.
> 
> https://tomcat.apache.org/tomcat-8.5-doc/logging.html#Using_java.util.logging_(default)
> 
> Best regards,
> Konstantin Kolinko
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



Question about the log variable in Filters

2022-08-31 Thread tianshuang
Hi,

In this commit 
<https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e>,
 the static modifier was removed from the log variable in the Filters class, 
but I don't understand why it needs to be removed. As far as I know, when a 
class is loaded by different classLoader, each classLoader creates its own 
instance of static variable. So, is it necessary to remove the static modifier 
here?

commit url: 
https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e

Thanks,
tianshuang