Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages being truncated #33

Open
mike-lawrence opened this issue Feb 15, 2018 · 3 comments
Open

Messages being truncated #33

mike-lawrence opened this issue Feb 15, 2018 · 3 comments

Comments

@mike-lawrence
Copy link

I'm looking at using loggr in a scenario where I'm creating new processes using system2(command = "Rscript" , args = c('--vanilla','my_script.R'), stdout = stdout_file, stderr = stderr_file, wait = FALSE), where I use loggr inside the script my_script. However, when I compare the log file to the stderr file, the loggr file seems to have truncated the messages. For example, a stderr file might have the contents:

Warning messages:
1: There were 38 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup 
2: Examine the pairs() plot to diagnose sampling problems

But the log file only has:

There were 
Examine the pairs() plot to diagnose sampling problems

All I'm doing to activate loggr in my_script.R is:

library(loggr)
my_formatter <- function(event) event$message
log_file(log_file_name,.formatter = my_formatter,subscriptions=c('message', 'warning','stop'))

Any idea what I should be doing instead to avoid truncation of those messages?

@mike-lawrence
Copy link
Author

dunno if it helps or not, but here's the code used by the package whose functions I'm using in my_script.R:

warning("There were ", n_d, " divergent transitions after warmup.",
    " Increasing adapt_delta above ", ad, " may help. See\n",
    "http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup"
    , call. = FALSE)

So it looks like loggr is only catching the first argument to warning()?

@mike-lawrence
Copy link
Author

I think the problem is in notify_loggr where you only pass the first element of args to .makeMessage.

@mike-lawrence
Copy link
Author

ok, think I fixed this, pull request here: #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant