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

Can the run time printing the event to console be controlled on the user side? #33

Closed
DaveParr opened this issue Jun 11, 2019 · 4 comments · Fixed by #40
Closed

Can the run time printing the event to console be controlled on the user side? #33

DaveParr opened this issue Jun 11, 2019 · 4 comments · Fixed by #40
Labels
enhancement New feature or request

Comments

@DaveParr
Copy link

DaveParr commented Jun 11, 2019

I believe (though I may be wrong) that

loginfo("Invoking function '%s' with parameters:\n%s", function_name, to_str(params))
is logging the entire event to cloudwatch.

I can see the value in doing this in many cases, but in the case where you may be passing a large data set in the body of the json, this makes the logs, and the in console test return, pretty impossible to use.

Is it possible to control this in your 'default' R runtime layers, without the user forking the project and rolling their own?

I've naively included logging::loglevel("WARN") at the start of script.R, though this doesn't seem to make an impact.

An ideal hypothetical for me would be to be able to specifically not log the body of json
An acceptable one would be to not capture logs from the runtime.R at all
Another acceptable one would be to control the log level of runtime.R, though this shouldn't impact the main script.R log level

I'm happy to do my best to look into this as well (I can see your project is picking up steam 🚂 !) but I might need a bit of guidance about where to start and how to implement.

@philipp94831
Copy link
Member

Hi @DaveParr,
I think it would be best to set the log level of these messages to debug (https://cran.r-project.org/web/packages/logging/logging.pdf). Then only if the logging config prints debug messages, they are printed to the console. This can be controlled in the user script I guess. Feel free to submit a PR :)

@philipp94831 philipp94831 added the enhancement New feature or request label Jun 11, 2019
@DaveParr
Copy link
Author

I've done the trivial easy part, i.e. the modify the logging level and PR is incoming. I'm still curious as to a method to control logging from script.R and how it might be possible. Working on it atm.

@philipp94831
Copy link
Member

Hi @DaveParr,
I also looked into it and made it work: https://github.com/bakdata/aws-lambda-r-runtime/compare/feature/debug-logging-in-runtime
To change the log level it suffices to do basicConfig(level='DEBUG'). The long log output generated by large payloads also is the final fix (among others) for #29
Do you mind if I merge my PR and decline yours for now?

@DaveParr
Copy link
Author

Totally fine, thank's a lot for doing it :)

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

Successfully merging a pull request may close this issue.

2 participants