You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mark Thomas <ma...@apache.org> on 2024/08/06 08:18:35 UTC

TLD scanner and debug logging

The current TLD scanner logs the following message if JARs are scanned 
but not TLDs are found:

<quote>
At least one JAR was scanned for TLDs yet contained no TLDs. Enable 
debug logging for this logger for a complete list of JARs that were 
scanned but no TLDs were found in them. Skipping unneeded JARs during 
scanning can improve startup time and JSP compilation time.
</quote>

However, the detailed log messages are now logged at trace level. This 
creates a couple of issues:

1. The message above is incorrect

2. With the message above corrected, and the correct logger level set, 
the messages still are not displayed because the logger handlers are 
configured to drop all messages below DEBUG level.


I'd like to propose the following changes:

- Change the default handler level to ALL. This should not change the
   current log output but should ensure messages are not dropped if a
   logger is explicitly configured to output trace (FINEST) messages.

- Change the message above to say "Enable trace logging..."


The only issue is that all the translations would need to be updated. I 
can mark them as fuzzy in POEditor which should mean they get flagged 
for review/update but whether anyone will update them is a different 
question. The alternative is to switch the TLDScanner back to logging at 
debug level.

Thoughts?

Mark

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


Re: TLD scanner and debug logging

Posted by Mark Thomas <ma...@apache.org>.
On 06/08/2024 10:50, Konstantin Kolinko wrote:
> вт, 6 авг. 2024 г. в 12:44, Mark Thomas <ma...@apache.org>:

<snip/>

>> I'll get those changes done.
> 
> +1
> 
> Looking at other usages of JarScannerCallback, e.g.
> o.a.catalina.startup.ContextConfig, I see no obvious problem. There is
> one message about DEBUG level (contextConfig.sci.info) but it is about
> a different situation (whether a stacktrace is being printed), and it
> is OK - it uses log.debug() there.
> 
> 
> Update the documentation?
> https://tomcat.apache.org/tomcat-11.0-doc/logging.html
> 
> a) It already mentions the "ALL" level. - OK
> 
> quote: "To enable debug logging for part of Tomcat's internals, you
> should configure both the appropriate logger(s) and the appropriate
> handler(s) to use the FINEST or ALL level. e.g.: "
> 
> b) There are two configuration samples (a global one, and one for the
> examples web application),
> 
> quote: "Example logging.properties file to be placed in $CATALINA_BASE/conf: "
> 
> - Update to s/FINE/ALL/.
> - The sample uses a FileHandler, but we are using AsyncFileHandler nowadays.
> 
> quote: "Example logging.properties for the servlet-examples web
> application to be placed in WEB-INF/classes inside the web
> application"
> 
> - The same as above
> - ConsoleHandler  is missing the ".encoding" setting.
> 
> c) BTW, in "Considerations for production usage" it says
> quote: "The handlers by default use the system default encoding to
> write the log files. It can be configured with encoding property. See
> Javadoc for details."
> 
> I think it is still true (as it actually talks about programmed defaults),
> but our default configuration has been configured to use "*.encoding =
> UTF-8" on all handlers, including the ConsoleHandler.
> 
> (At the time when that phrase was written, ConsoleHandler was
> configured with the system encoding.)

Thanks for the review. I've updated the docs.

Mark

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


Re: TLD scanner and debug logging

Posted by Konstantin Kolinko <kn...@gmail.com>.
вт, 6 авг. 2024 г. в 12:44, Mark Thomas <ma...@apache.org>:
>
> On 06/08/2024 09:56, Rémy Maucherat wrote:
> > On Tue, Aug 6, 2024 at 10:19 AM Mark Thomas <ma...@apache.org> wrote:
> >>
> >> The current TLD scanner logs the following message if JARs are scanned
> >> but not TLDs are found:
> >>
> >> <quote>
> >> At least one JAR was scanned for TLDs yet contained no TLDs. Enable
> >> debug logging for this logger for a complete list of JARs that were
> >> scanned but no TLDs were found in them. Skipping unneeded JARs during
> >> scanning can improve startup time and JSP compilation time.
> >> </quote>
> >>
> >> However, the detailed log messages are now logged at trace level. This
> >> creates a couple of issues:
> >>
> >> 1. The message above is incorrect
> >>
> >> 2. With the message above corrected, and the correct logger level set,
> >> the messages still are not displayed because the logger handlers are
> >> configured to drop all messages below DEBUG level.
> >>
> >>
> >> I'd like to propose the following changes:
> >>
> >> - Change the default handler level to ALL. This should not change the
> >>     current log output but should ensure messages are not dropped if a
> >>     logger is explicitly configured to output trace (FINEST) messages.
> >>
> >> - Change the message above to say "Enable trace logging..."
> >>
> >>
> >> The only issue is that all the translations would need to be updated. I
> >> can mark them as fuzzy in POEditor which should mean they get flagged
> >> for review/update but whether anyone will update them is a different
> >> question. The alternative is to switch the TLDScanner back to logging at
> >> debug level.
> >>
> >> Thoughts?
> >
> > So I downgraded these because they did not really look like debug to
> > me, but more like traces. The separation between the two is quite
> > subtle ;) Sorry for the trouble ...
>
> No worries.
>
> > So instead of doing too much for this, and since this log is likely
> > useful, I would upgrade back the noTldInJar to debug since most likely
> > admin action is needed.
>
> OK. That is a much simpler solution.
>
> > Otherwise +1 for the idea of enabling ALL by default, there would be
> > less fiddling around when trying to enable trace.
>
> Exactly.
>
> I'll get those changes done.

+1

Looking at other usages of JarScannerCallback, e.g.
o.a.catalina.startup.ContextConfig, I see no obvious problem. There is
one message about DEBUG level (contextConfig.sci.info) but it is about
a different situation (whether a stacktrace is being printed), and it
is OK - it uses log.debug() there.


Update the documentation?
https://tomcat.apache.org/tomcat-11.0-doc/logging.html

a) It already mentions the "ALL" level. - OK

quote: "To enable debug logging for part of Tomcat's internals, you
should configure both the appropriate logger(s) and the appropriate
handler(s) to use the FINEST or ALL level. e.g.: "

b) There are two configuration samples (a global one, and one for the
examples web application),

quote: "Example logging.properties file to be placed in $CATALINA_BASE/conf: "

- Update to s/FINE/ALL/.
- The sample uses a FileHandler, but we are using AsyncFileHandler nowadays.

quote: "Example logging.properties for the servlet-examples web
application to be placed in WEB-INF/classes inside the web
application"

- The same as above
- ConsoleHandler  is missing the ".encoding" setting.

c) BTW, in "Considerations for production usage" it says
quote: "The handlers by default use the system default encoding to
write the log files. It can be configured with encoding property. See
Javadoc for details."

I think it is still true (as it actually talks about programmed defaults),
but our default configuration has been configured to use "*.encoding =
UTF-8" on all handlers, including the ConsoleHandler.

(At the time when that phrase was written, ConsoleHandler was
configured with the system encoding.)

Best regards,
Konstantin Kolinko

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


Re: TLD scanner and debug logging

Posted by Mark Thomas <ma...@apache.org>.
On 06/08/2024 09:56, Rémy Maucherat wrote:
> On Tue, Aug 6, 2024 at 10:19 AM Mark Thomas <ma...@apache.org> wrote:
>>
>> The current TLD scanner logs the following message if JARs are scanned
>> but not TLDs are found:
>>
>> <quote>
>> At least one JAR was scanned for TLDs yet contained no TLDs. Enable
>> debug logging for this logger for a complete list of JARs that were
>> scanned but no TLDs were found in them. Skipping unneeded JARs during
>> scanning can improve startup time and JSP compilation time.
>> </quote>
>>
>> However, the detailed log messages are now logged at trace level. This
>> creates a couple of issues:
>>
>> 1. The message above is incorrect
>>
>> 2. With the message above corrected, and the correct logger level set,
>> the messages still are not displayed because the logger handlers are
>> configured to drop all messages below DEBUG level.
>>
>>
>> I'd like to propose the following changes:
>>
>> - Change the default handler level to ALL. This should not change the
>>     current log output but should ensure messages are not dropped if a
>>     logger is explicitly configured to output trace (FINEST) messages.
>>
>> - Change the message above to say "Enable trace logging..."
>>
>>
>> The only issue is that all the translations would need to be updated. I
>> can mark them as fuzzy in POEditor which should mean they get flagged
>> for review/update but whether anyone will update them is a different
>> question. The alternative is to switch the TLDScanner back to logging at
>> debug level.
>>
>> Thoughts?
> 
> So I downgraded these because they did not really look like debug to
> me, but more like traces. The separation between the two is quite
> subtle ;) Sorry for the trouble ...

No worries.

> So instead of doing too much for this, and since this log is likely
> useful, I would upgrade back the noTldInJar to debug since most likely
> admin action is needed.

OK. That is a much simpler solution.

> Otherwise +1 for the idea of enabling ALL by default, there would be
> less fiddling around when trying to enable trace.

Exactly.

I'll get those changes done.

Mark

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


Re: TLD scanner and debug logging

Posted by Rémy Maucherat <re...@apache.org>.
On Tue, Aug 6, 2024 at 10:19 AM Mark Thomas <ma...@apache.org> wrote:
>
> The current TLD scanner logs the following message if JARs are scanned
> but not TLDs are found:
>
> <quote>
> At least one JAR was scanned for TLDs yet contained no TLDs. Enable
> debug logging for this logger for a complete list of JARs that were
> scanned but no TLDs were found in them. Skipping unneeded JARs during
> scanning can improve startup time and JSP compilation time.
> </quote>
>
> However, the detailed log messages are now logged at trace level. This
> creates a couple of issues:
>
> 1. The message above is incorrect
>
> 2. With the message above corrected, and the correct logger level set,
> the messages still are not displayed because the logger handlers are
> configured to drop all messages below DEBUG level.
>
>
> I'd like to propose the following changes:
>
> - Change the default handler level to ALL. This should not change the
>    current log output but should ensure messages are not dropped if a
>    logger is explicitly configured to output trace (FINEST) messages.
>
> - Change the message above to say "Enable trace logging..."
>
>
> The only issue is that all the translations would need to be updated. I
> can mark them as fuzzy in POEditor which should mean they get flagged
> for review/update but whether anyone will update them is a different
> question. The alternative is to switch the TLDScanner back to logging at
> debug level.
>
> Thoughts?

So I downgraded these because they did not really look like debug to
me, but more like traces. The separation between the two is quite
subtle ;) Sorry for the trouble ...

So instead of doing too much for this, and since this log is likely
useful, I would upgrade back the noTldInJar to debug since most likely
admin action is needed.

Otherwise +1 for the idea of enabling ALL by default, there would be
less fiddling around when trying to enable trace.

Rémy

> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

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


AW: TLD scanner and debug logging

Posted by "Döscher, Andreas (ESI)" <an...@adp.com.INVALID>.
Hi Mark,
one more thing, the shipped conf/logger.properties should also reflect the changes. For example it says (in 9.0.93):

# To see debug messages in TldLocationsCache, uncomment the following line:
#org.apache.jasper.compiler.TldLocationsCache.level = FINE

I would expect, that to be FINEST too...

Thanks,
  Andreas

-----Ursprüngliche Nachricht-----
Von: Mark Thomas <ma...@apache.org>
Gesendet: Dienstag, 6. August 2024 10:19
An: Tomcat Developers List <de...@tomcat.apache.org>
Betreff: TLD scanner and debug logging


WARNING: Do not click links or open attachments unless you recognize the source of the email and know the contents are safe.

The current TLD scanner logs the following message if JARs are scanned but not TLDs are found:

<quote>
At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
</quote>

However, the detailed log messages are now logged at trace level. This creates a couple of issues:

1. The message above is incorrect

2. With the message above corrected, and the correct logger level set, the messages still are not displayed because the logger handlers are configured to drop all messages below DEBUG level.


I'd like to propose the following changes:

- Change the default handler level to ALL. This should not change the
   current log output but should ensure messages are not dropped if a
   logger is explicitly configured to output trace (FINEST) messages.

- Change the message above to say "Enable trace logging..."


The only issue is that all the translations would need to be updated. I can mark them as fuzzy in POEditor which should mean they get flagged for review/update but whether anyone will update them is a different question. The alternative is to switch the TLDScanner back to logging at debug level.

Thoughts?

Mark

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



This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system.