OHDSI Home | Forums | Wiki | Github

ParallelLogger v1.2.0


(Martijn Schuemie) #1

I’ve just released ParallelLogger v1.2.0, which has a new feature that might be of interest for those creating study packages: You can now create an error report logger. This will create a report file whenever a fatal error occurs during execution. (the user will be notified: “An error report has been created at …”) It will even log errors within sub-threads. This report is intended to be shared with the package developer to help debug. Here’s an example report:

Thread: Main
Message: Error in DatabaseConnector::connect(connectionDetails) : object ‘connectionDetails’ not found
Level: FATAL
Time: 2020-04-22 07:07:27

Stack trace:
3: CreateAllCohorts.R#50: DatabaseConnector::connect(connectionDetails)
2: Main.R#82: createCohorts(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, cohortDatabaseSchema = cohortDatabaseSchema, cohortTable =
1: execute(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, cohortDatabaseSchema = cohortDatabaseSchema, cohortTable = cohortTable, orac

R version:
R version 3.6.1 (2019-07-05)

Platform:
x86_64-w64-mingw32

Attached base packages:

  • stats
  • graphics
  • grDevices
  • utils
  • datasets
  • methods
  • base

Other attached packages:

  • Covid19Il6JakInhibitorsSccs (0.0.1)
  • DatabaseConnector (3.0.0)

Here’s an example where I include the logger in a study package.

The new version is available on GitHub and has been accepted for CRAN, so should appear there shortly.

(Also note that the names of the default loggers have changed. For example, the default file logger is no longer called ‘DEFAULT’ but ‘DEFAULT_FILE_LOGGER’, so to unregister you should use ParallelLogger::unregisterLogger("DEFAULT_FILE_LOGGER") )


(Ajit Londhe) #2

Hi @schuemie – this is really great. So now, if we were to add this to Achilles, where we already have simple logging, could we generate a separate detailed error report for every distinct analysis error that occurs?

If so, is there some lineage between the transactional log file line items and the associated error report files?


(Martijn Schuemie) #3

Well, I had imagined the error report logger would be used for fatal errors, so the error report would naturally correspond with the latest entry in the running log :wink:

If you want more detail on non-fatal errors, for example just the message + stack trace, you could also add a separate file logger with threshold = "ERROR" and the layoutStackTrace layout.

You could easily link your detailed error-stack-trace log to your overall log on time stamp (and message, although timestamp should be unique enough).

(I don’t know if you’re using tryCatch, but note that it consumes errors, so will not trigger ParallelLogger unless you manually log the error you caught, for example using logError)


t