[Unicode]   Common Locale Data Repository : Bug Tracking Home | Site Map | Search
 
Modify

CLDR Ticket #6996(accepted unknown)

Opened 3 years ago

Last modified 16 months ago

Introduce the possibility to log File opening [only branch]

Reported by: ribnitz Owned by: anybody
Component: perf Data Locale:
Phase: dsub Review:
Weeks: Data Xpath:
Xref:

Description

It would make sense to introduce the possibility to log files being opened, as this may be useful information when debugging issues (e.g. related to caching entries). From the developer point of view, logging that a file was opened/read should be easy, but the respective class should attach a Stacktrace to each invocation.

All location which read files either using InputStreams or Readers need to be instrumented to log the access, if requested to do so.

Since the behavior is only useful for debugging, it should be disabled by default, but its status should be obtainable through CLDRConfig.

Attachments

Change History

comment:1 Changed 3 years ago by emmons

  • Owner changed from anybody to ribnitz
  • Milestone changed from UNSCH to 25final

comment:2 Changed 3 years ago by mark

  • Milestone changed from 25final to 26dsub

comment:3 Changed 3 years ago by ribnitz

  • Status changed from new to reviewing
  • Review set to mark

comment:4 Changed 3 years ago by emmons

  • Status changed from reviewing to accepted
  • Review mark deleted

comment:5 Changed 3 years ago by emmons

  • Milestone changed from 26dsub to 26dvet

Moving all 26dsub to 26dvet. Please assess the need to complete tickets by 26dvet, which is 2014-06-19

comment:6 Changed 3 years ago by ribnitz

  • Status changed from accepted to reviewing
  • Review set to mark

comment:7 Changed 3 years ago by mark

  • Status changed from reviewing to accepted

you repeat lines like this.

if (f.canRead()) {

FileOpeningCounter.getInstance().add(f.getAbsolutePath());

}

for terseness, combine into static method(s):

FileOpeningCounter.add(f);
FileOpeningCounter.addIfReadable(f);

...

Moreover, make each one return the file for chaining.

That makes much simpler code:

OLD
return new BufferedReader(new InputStreamReader(new FileInputStream(new File(directory, file)), charset));

YOURS

209 File f=new File(directory, file);
210 if (f.canRead()) {
211 FileOpeningCounter.getInstance().add(f.getAbsolutePath());
212 }
213 return new BufferedReader(new InputStreamReader(new FileInputStream(f), charset));

COULD BE

return new BufferedReader(new InputStreamReader(new FileInputStream(FileOpeningCounter.add(new File(directory, file))), charset));

Note: it seems simpler if add always internally calls f.getAbsolutePath() [if readable]

There is also no need to call getInstance at all if the flags COUNT_FILE_OPENINGS and DEBUG_READS are off.

comment:8 Changed 3 years ago by mark

  • Owner changed from ribnitz to googler

comment:9 Changed 3 years ago by mark

  • Owner changed from googler to anybody
  • Milestone changed from 26dvet to 27dsub

comment:10 Changed 3 years ago by markus

  • Phase set to dsub
  • Milestone changed from 27dsub to 27

comment:11 Changed 2 years ago by emmons

  • Component changed from unknown to perf

comment:12 Changed 2 years ago by emmons

  • Milestone changed from 27 to UNSCH

Moving all 27+anybody tickets to UNSCH.

comment:13 Changed 16 months ago by mark

  • Review mark deleted
  • Summary changed from Introduce the possibility to log File opening to Introduce the possibility to log File opening [only branch]
View

Add a comment

Modify Ticket

Action
as accepted
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.