RFR: 8328880: Events::log_exception should limit the size of the logging message

Vladimir Kozlov kvn at openjdk.org
Fri Aug 23 01:05:13 UTC 2024


On Tue, 20 Aug 2024 05:22:40 GMT, David Holmes <dholmes at openjdk.org> wrote:

> This simple enhancement allows for `Exceptions::_throw` to limit the message length printed by `Events::log_exception` in the same way that unified logging is limited. We simply allow a `message_length_limit` variable to be passed down - default value zero which means no limit (i.e. the full `strlen` of the message will be printed).
> 
> Testing:
> - tiers 1-3
> 
> Thanks

src/hotspot/share/utilities/events.cpp line 169:

> 167:   h_exception->print_value_on(&st);
> 168:   if (message != nullptr) {
> 169:     int len = message_length_limit > 0 ? message_length_limit : (int)strlen(message);

Do we need to check that `message_length_limit <= (int)strlen(message)`?
Or it is intentional to reserve bigger space in output than `message`?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20638#discussion_r1728088097


More information about the hotspot-dev mailing list