Learn R Programming

ParallelLogger

ParallelLogger is part of HADES.

Introduction

Support for parallel computation with progress bar, and option to stop or proceed on errors. Also provides logging to console and disk, and the logging persists in the parallel threads. Additional functions support function call automation with delayed execution (e.g. for executing functions in parallel).

Features

  • Functions for parallel computation.
  • Functions for logging, including automated logging for errors and warnings.
  • Functions used for automating analyses.

Examples

# Run a function in parallel:
fun <- function(x) {
  return (x^2)
}

cluster <- makeCluster(numberOfThreads = 3)
result <- clusterApply(cluster, 1:10, fun)
stopCluster(cluster)

# Create a file logger:
addDefaultFileLogger("log.txt")
logTrace("Hello world")

Technology

ParallelLogger is an R package.

System Requirements

Requires R (version 4.0.0 or higher)

Getting Started

In R, to install the latest stable version, install from CRAN:

install.packages("ParallelLogger")

To install the latest development version, install from the develop branch in GitHub:

install.packages("remotes")
library(remotes)
install_github("ohdsi/ParallelLogger", ref = "develop")

User Documentation

Documentation can be found on the package website.

PDF versions of the documentation is also available:

Contributing

Read here how you can contribute to this package.

Support

  • Developer questions/comments/feedback: OHDSI Forum
  • We use the GitHub issue tracker for all bugs/issues/enhancements

Contributing

Read here how you can contribute to this package.

License

ParallelLogger is licensed under Apache License 2.0

Development

ParallelLogger is being developed in R Studio.

Development status

Ready for use

Acknowledgements

  • This project is supported in part through the National Science Foundation grant IIS 1251151.

Copy Link

Version

Install

install.packages('ParallelLogger')

Monthly Downloads

2,399

Version

3.4.2

License

Apache License 2.0

Issues

Pull Requests

Stars

Forks

Maintainer

Martijn Schuemie

Last Published

June 5th, 2025

Functions in ParallelLogger (3.4.2)

launchLogViewer

Launch the log viewer Shiny app
logError

Log a message at the ERROR level
createConsoleAppender

Create console appender
createArgFunction

Create an argument function
layoutEmail

Logging layout for e-mail
excludeFromList

Exclude variables from a list of objects of the same type
logFatal

Log a message at the FATAL level
unregisterLogger

Unregister a logger
layoutTimestamp

Logging layout with timestamp
logInfo

Log a message at the INFO level
logDebug

Log a message at the DEBUG level
matchInList

In a list of object of the same type, find those that match the input
loadSettingsFromJson

Load a settings object from a JSON file
stopCluster

Stop the cluster
layoutStackTrace

Logging layout with stack trace
logTrace

Log a message at the TRACE level
getPhysicalMemory

Get the total amount of physical memory
registerLogger

Register a logger
createEmailAppender

Create e-mail appender
createFileAppender

Create file appender
layoutSimple

Simple logging layout
layoutParallel

Logging layout for parallel computing
logWarn

Log a message at the WARN level
makeCluster

Create a cluster of nodes for parallel computation
saveSettingsToJson

Save a settings object as JSON file
layoutErrorReport

Logging layout for error report
selectFromList

Select variables from a list of objects of the same type
addDefaultEmailLogger

Add the default e-mail logger
clearLoggers

Remove all registered loggers
clusterRequire

Require a package in the cluster
addDefaultFileLogger

Add the default file logger
convertSettingsToJson

Convert a settings object to a JSON string
ParallelLogger-package

ParallelLogger: Support for Parallel Computation, Logging, and Function Automation
clusterApply

Apply a function to a list using the cluster
addDefaultErrorReportLogger

Add the default error report logger
convertJsonToSettings

Converts a JSON string to a settings object
addDefaultConsoleLogger

Add the default console logger
getLoggers

Get all registered loggers
getThreadNumber

Return the number of the current thread
createLogger

Create a logger