wlogsolutions / r-logging Goto Github PK
View Code? Open in Web Editor NEWR port of the popular log4j logging module
R port of the popular log4j logging module
Hi there, I did what we (@ws171913 and myself) had agreed in issue transfer old issues to new repository (#10)
in your fork, but since part of the plan included removal your fork, we also lost the discussion and description.
what we did:
that's it.
I suppose you should now remove me from your organization.
some handlers (specifically the sentryHandler) need check or load packages in order to run. or they might want to test for the presence of all needed parameters. it would be nice to have a dry-run option that informs the handler action not to do anything except check the environment.
So you would be able to follow the workflow:
without this dry-run option, you are here:
I was wondering to what extent r-logging
and Python's logging
could be affected or have related issues. It seems like the vulnerability is specific to Java, but thought it would be wise to ask here.
Thank you for your time,
Ravi B. Sojitra
please add a rotating file handler
see http://stackoverflow.com/questions/4883272
this is relevant on windows, where you do not have logrotate and only in the cases where the solution at http://www.datori.org/?p=7 is not enough.
the futile package does not seem to be accessible for reference.
this causes a WARNING, which ends cluttering the package check.
since this is there only for historical reasons and I never had a look at futile after the first weeks while developing this package, I think we can safely remove the reference.
both test.loggingToFile
and test.loggingToFile.oo
fail with the message:
Error in file(file, ifelse(append, "a", "w")) :
invalid 'description' argument
I often find myself to write
logdebug("x: %s", x)
What do you think about supporting
logdebug(x)
as a shortcut? This should be accompanied by a parameter to explicitly turn on or off this behavior:
logdebug(msg, ..., logger='', print.name=!is.character(msg))
The same holds for all other debug levels, of course.
from an email (Paul Roebuck, 2014-10-03)
can I add a custom level?
Desired processing follows...
R> addLevelName <- function(value, levelname) {
stopifnot(is.numeric(value) && length(value) == 1)
stopifnot(is.character(levelname) && length(levelname) == 1 && nzchar(levelname))
names(value) <- levelname
loglevels <<- sort(c(loglevels, as.integer(value)))
}
R> addLevelName(9, 'NUMBER9')
R> loglevels
NOTSET FINEST FINER FINE NUMBER9 DEBUG INFO
WARNING WARN ERROR CRITICAL FATAL
0 1 4 7 9 10 20
30 30 40 50 50
Ruuid doesn't belong to the current release or devel version of Bioconductor anymore so I am getting errors when trying to install it on R 3.0.1. Should this dependency be removed since BioC seem to be deprecating it?
Louis
the test test.recordIsEmitted.deepToRoot.DI.dropped
fails with message:
Error in structure(function (value) :
invalid replacement for field 'level', should be from
class "numeric" or a subclass (was class "NULL")
Hey ๐
I noticed that logging started to fail when I pass dates:
loginfo(as.Date("2022-01-01"))
Error in as.Date.default(e) :
do not know how to convert 'e' to class "Date"
I think this happened once I upgraded R to 4.1.2 from 3.6.3.
Is that a known issue, or are we not supposed to pass dates anymore?
Thanks!
Whenever I try to lower the logging level from INFO (20), I'm never able to printout messages passed to logdebug, logfine, etc...
test case:
> library(logging)
> basicConfig("DEBUG") # or something lower than 20
> getLogger()
Reference class object of class "Logger"
Field "name":
[1] ""
Field "handlers":
$basic.stdout
<environment: 0x9e23c8c>
Field "level":
DEBUG
10
> loginfo("info")
2013-02-07 11:48:29 INFO::info # ok, as I expected...
> logdebug("debug") # ... shouldn't I see the debug message here?
> logReset() # let's see if at higher levels works
> basicConfig("ERROR")
> getLogger()
Reference class object of class "Logger"
Field "name":
[1] ""
Field "handlers":
$basic.stdout
<environment: 0x8d64934>
Field "level":
ERROR
40
> loginfo("info")
> logwarn("warn")
> logerror("error")
2013-02-07 11:50:05 ERROR::error # no problems here.
The version I'm using through CRAN is 0.6-92, maybe I should update from here ;)
HTH,
Giuseppe
from an email (Paul Roebuck, 2014-10-03)
this doesn't appear to work anymore (logging 0.7-103)...
R> setLevel(30, getHandler('basic.stdout'))
Error in as.environment(pos) : using 'as.environment(NULL)' is defunct
Hi, thanks for writing this logging package.
I just realised the leading whitespaces in a message are trimmed, I am not sure if it is a bug or a feature, but wonder if there's a way to preserve those whitespaces?
R> loginfo("a")
2016-08-30 16:43:51 INFO::a
R> loginfo(" a")
2016-08-30 16:43:55 INFO::a
Thanks
this function sounds useful: http://docs.python.org/2/library/logging.html#logging.shutdown
for example when you have a handler that is producing a log-file that has a prologue and an epilogue, you need to make sure that the epilogue section is written in all cases.
in Python, this is achieved having logging.shutdown invoke all .close methods of all registered handlers. we can do the same here. again the advantage of mimicking the behaviour of the Python library is that it is very well defined and clearly documented.
currently, logging.logReset destroys all content of the logging subsystem.
it could be less destructive by keeping the object representing the root logger.
this would enable scripts to rely on the pointer to the root logger also after the subsystem has been reset.
Calling a logging function with a new named logger creates a new logger implictly, with level = INFO
. Is this intended? I would suggest inheriting the level (and possibly the handlers etc) from logging.ROOT
.
library("logging")
basicConfig(level = 0)
logdebug("test")
#> 2019-07-11 11:53:30 DEBUG::test
# Current, unexpected behaviour
logdebug("test", logger = "named_logger")
# No output
# Proposed behaviour: named loggers should use the root config by default.
logdebug("test", logger = "named_logger")
#> 2019-07-11 11:53:45 DEBUG::test
ls(logging:::logging.options)
[1] "logging.ROOT" "logging.ROOT.named_logger"
In this example, I would have expected the logging.ROOT.name_logger
to be set at DEBUG level.
This behaviour can be traced to how logging::getLogger
creates loggers that are not yet in logging.options
using level = namedLevel("INFO")
.
logging::getLogger <- function (name = "", ...) {
if (name == "") {
fullname <- "logging.ROOT"
}
else {
fullname <- paste("logging.ROOT", name, sep = ".")
}
if (!exists(fullname, envir = logging.options)) {
logger <- Logger$new(name = name, handlers = list(),
level = namedLevel("INFO"))
updateOptions.environment(logger, ...)
logging.options[[fullname]] <- logger
if (fullname == "logging.ROOT") {
.basic_config(logger)
}
}
logging.options[[fullname]]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.