Is there a standard registration package for R?

Am I looking for a standard (if any) registration package for R and some usage examples?

I also do not see any of the packages listed: http://cran.r-project.org/web/packages/

+67
logging r
Dec 18 '09 at 13:54
source share
7 answers

I just sent the logging package to CRAN. it is based on some parts of the old version of the "useless" package (Brian Lee Young Row).

You will find the logging package:

It mimics the standard python logging package, but please be careful if you decide to use it. I also tried to document this using the example of the package home page in R-Forge, which points to a couple of possible usage sessions .

Any feedback will be read with interest!

+47
Jan 15 '10 at 11:21
source share

There is currently no native library for logging. But there are four on CRAN:

1) registration
- just & log4j like
- recalls the standard Python library (uses this documentation as a guide)
- the author started it in 2010, "mature" by 2012
- accepted by WLOGSolutions
- actively supported

2) futile.logger (recommended! I use it too)
- actively supporting
- supports json error logging
- semantics similar to Pythons logging, as well as log4j-like
- can be difficult

3) log4r
- simple and similar to log4j
- not in operation since 2014

4) luzlogr
- supersimple - (open, write, close file)

+22
Aug 24 '16 at 17:28
source share

I suggest a futile.logger package, it implements several hierarchical loggers with formatted output strings, and you can send output in different ways. It also implements registrars for each package.

+15
Mar 28 '13 at 20:12
source share

Built-in functions (base base) - this is a "warning", "message", "stop". These features support multiple languages. If you want to enter the file, perhaps you can use these functions along with "sink".

A search using RSeek has made the package useless with the log function.

+8
Dec 18 '09 at 15:34
source share

I started the logR project in June 2014. Initially, it was an R exception handler with the ability to register with csv and DBI / RODBDC / RJDBC.
Starting with version 2.1, I switched to supporting only PostgreSQL as a backend for logs.
If you can arrange one table in a postgres database, you can easily use logR.

Upstream repo and github mirror .

Some logR functions:

  • transaction logging: insert log, evaluate expression, update log
  • enter postgres database
  • records errors, warnings, messages, interrupts.
  • log process metadata: in / out nrow, flexible list of custom metadata
  • high accuracy of synchronization with the microbenchmarkCore option
  • parallel processing support
  • hierarchical logs - log log identifier (new in 2.1.5)

This requires RPostgreSQL and data.table .

Using:

 # install logR install.packages("logR", repos = c("https://jangorecki.imtqy.com/logR", "https://cran.rstudio.com")) # attach logR library(logR) # setup connection, default to env vars: `POSTGRES_DB`, etc. # if you have docker then: docker run --rm -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD=postgres --name pg-logr postgres:9.5 logR_connect() # [1] TRUE # create logr table logR_schema() # make some logging and calls logR(1+2) # OK #[1] 3 logR(log(-1)) # warning #[1] NaN f = function() stop("an error") logR(r <- f()) # stop #NULL g = function(n) data.frame(a=sample(letters, n, TRUE)) logR(df <- g(4)) # out rows # a #1 u #2 c #3 w #4 p # try CTRL+C / 'stop' button to interrupt logR(Sys.sleep(15)) # wrapper to: dbReadTable(conn = getOption("logR.conn"), name = "logr") logR_dump() # logr_id logr_start expr status alert logr_end timing in_rows out_rows mail message cond_call cond_message #1: 1 2016-02-08 16:35:00.148 1 + 2 success FALSE 2016-02-08 16:35:00.157 0.000049163 NA NA FALSE NA NA NA #2: 2 2016-02-08 16:35:00.164 log(-1) warning TRUE 2016-02-08 16:35:00.171 0.000170801 NA NA FALSE NA log(-1) NaNs produced #3: 3 2016-02-08 16:35:00.180 r <- f() error TRUE 2016-02-08 16:35:00.187 0.000136896 NA NA FALSE NA f() an error #4: 4 2016-02-08 16:35:00.197 df <- g(4) success FALSE 2016-02-08 16:35:00.213 0.000696145 NA 4 FALSE NA NA NA #5: 5 2016-02-08 16:35:00.223 Sys.sleep(15) interrupt TRUE 2016-02-08 16:35:05.434 5.202319000 NA NA FALSE NA NA NA 

Additional examples can be found in the logR unit tests.

+3
Feb 08 '16 at 16:37
source share

I do not know anyone, so in the next few days I was going to release a wrapper for log4j (I tested it for a while). I will let you know when it will be available.

+2
Dec 18 '09 at 14:17
source share

A simpler alternative than logging and futile.logger :

log4r ( cran , github )

The log4r package is designed to provide a clean, lightweight, object-oriented approach to logging into R, based on roughly the broadly emulated log4j API. The following example shows how to use the log in practice to output output to a plain text log file.

+2
Jan 21 '16 at 7:41
source share



All Articles