tristantarrant commented on PR #1848:
URL: https://github.com/apache/logging-log4j2/pull/1848#issuecomment-1757250950

   Hi @vy, I agree we need a better solution.
   
   - avoid constructing that ridiculous regex with all the timezone names 
anyway. A simple `[A-Za-z0-9\+\-/\s]+` should be enough
   - if the user uses a `GMT-xx` or RFC822-style timezone, use the quick path
   - if the user uses a _primary_ timezone name (e.g. `Europe/Rome`), use 
`TimeZone.getTimeZone()`
   - otherwise fallback to obtaining the full list of zone names and aliases. 
Unfortunately there is no other way to look up timezones by alias... By using 
the approach used in my PR we can save ~700K of heap over the use of 
`DateFormatSymbols.getInstance(locale).getZoneStrings();` (as you can see from 
the table I've put in the Jira)
   
   Unfortunately this does not solve the bigger issue: if someone uses 
`SimpleDateFormat` in their code, they are going to trigger the full JDK 
caching of timezones, rendering our fix useless anyway.
   
   A possibility, aside from fixing this in the JDK in some way, is to install 
an alternate `ZoneRulesProvider` using the 
`java.time.zone.DefaultZoneRulesProvider` system property. Such a provider 
would avoid caching the full TZ dataset. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to