I think it’s not clear to me when you say “log”. The activation record has a log field and a result field. Are you trying to add error logs to the result field?
At first I thought you meant you wanted to omit the result field from the activation record except during errors. But I think I misunderstood. Maybe an example will be helpful. -r > On Sep 5, 2019, at 7:31 PM, Ruediger Maass <ruediger.ma...@de.ibm.com> wrote: > > Hi there, > > may I ask for comments? Annotations for the decision whether results > should be added in the action log or not would not fix the problem we try > to solve and is a different, independent question. > > We want to add error information in the log but not print results in the > good (i.e., success) case. This can only be done if one inspects the > activation 'success' field (or the 'error' field in the result) and in > this case log the result that contains the error information. We could > hard-code a strategy in `ActivationFileStorage`. But this has the > disadvantage that it would change the default behavior of OpenWhisk and > not everyone might like this and may have different opinions about the > "right" strategy. Therefore we propose the more flexible way of > introducing a flag, let anyone decide on the right strategy, and not > hard-coding a strategy. In the default case, there would be no behavioral > change of OpenWhisk with the flag, i.e. no one needs to care about the > flag if not wanted. But it would help us and maybe others to solve the > described problem. > > Thanks, Ruediger > > > > From: Ruediger Maass/Germany/IBM > To: dev@openwhisk.apache.org > Date: 04/09/2019 11:07 > Subject: Re: Allow decision about action result inclusion in logs > on a per call basis > > > Let me please add the information that the behavior of OpenWhisk is not > changed by this fix. The provided feature must be actively chosen. > > Thanks, Ruediger > > > > > From: "Ruediger Maass" <ruediger.ma...@de.ibm.com> > To: dev@openwhisk.apache.org > Date: 04/09/2019 10:42 > Subject: [EXTERNAL] Re: Allow decision about action result > inclusion in logs on a per call basis > > > > Thanks for the discussion! > > This PR is only about suppressing results in action logs. If a user still > wants to have the result in the action log then he or she can simply add a > > log statement in the action for that. Why should we introduce a new > mechanism for this like an annotation for automatically adding the result > to the log (or not)? Seems complicated. > > In our specific case we need the flag per invocation because we want to > the add the result in error cases. For example: main is not defined, > compile error in action, etc. see below: > > 1) no main() in js > "result": { > "error": "Initialization has failed due to: ReferenceError: > main is not defined\n > at eval (eval at <anonymous> > (/nodejsAction/runner.js:79:109), <anonymous>:8:8)\n > at eval (eval at <anonymous> > (/nodejsAction/runner.js:79:109), <anonymous>:8:14)\n > at NodeActionRunner.init (/nodejsAction/runner.js:79:45)\n > at doInit (/nodejsAction/src/service.js:142:31)\n > at initCode (/nodejsAction/src/service.js:81:24)\n > at /nodejsAction/app.js:69:13\n > at Layer.handle [as handle_request] > (/node_modules/express/lib/router/layer.js:95:5)\n > at next > (/node_modules/express/lib/router/route.js:131:13)\n > at Route.dispatch > (/node_modules/express/lib/router/route.js:112:3)\n > at Layer.handle [as handle_request] > (/node_modules/express/lib/router/layer.js:95:5)" > > 2) compile Error > "result": { > "error": "Initialization has failed due to: SyntaxError: > Unexpected identifier\n > at NodeActionRunner.init > (/nodejsAction/runner.js:79:109)\n > at doInit (/nodejsAction/src/service.js:142:31)\n > at initCode (/nodejsAction/src/service.js:81:24)\n > at /nodejsAction/app.js:69:13\n > at Layer.handle [as handle_request] > (/node_modules/express/lib/router/layer.js:95:5)\n > at next > (/node_modules/express/lib/router/route.js:131:13)\n > at Route.dispatch > (/node_modules/express/lib/router/route.js:112:3)\n > at Layer.handle [as handle_request] > (/node_modules/express/lib/router/layer.js:95:5)\n > at /node_modules/express/lib/router/index.js:277:22\n > at Function.process_params > (/node_modules/express/lib/router/index.js:330:12)" > > > This kind of information cannot be logged anywhere else and does not > contain sensible information. It is very helpful information for the > customer to correct the action. So we do not want to suppress this > information. > > > > From: James Thomas <jthomas...@gmail.com> > To: dev@openwhisk.apache.org > Date: 03/09/2019 15:24 > Subject: [EXTERNAL] Re: Allow decision about action result > inclusion in logs on a per call basis > > > > This is a sensible change and I agree with what Rodric has suggested: > can we make this a per-action annotation? > >> On Tue, 3 Sep 2019 at 13:28, Rodric Rabbah <rod...@gmail.com> wrote: >> >>> Action results may contain sensible data that should not be logged. >> >> I interpret this to mean: not stored in the activation record. >> >> If this is what you mean, why not make this a feature controlled per > action >> using an annotation and let the user decide: ok to save the result, not > ok >> to save the result, only save the result on error. >> >> -r >> >> On Tue, Sep 3, 2019 at 8:17 AM Ruediger Maass > <ruediger.ma...@de.ibm.com> >> wrote: >> >>> Action results may contain sensible data that should not be logged. > There >>> is a system configuration flag (writeResultToFile) that can be used to >>> switch on or off the result inclusion in logs. But this is a global > switch >>> that holds for all activations. In our case we want to able to decide > per >>> activation whether or not the result should be included in the log or > not. >>> In our special case we want results to be included in case of errors > (in >>> other words, our predicate function for the decision is: 'Does the > result >>> contain an error field?'). But also other decision logic may be >>> applicable. >>> >>> This PR > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_openwhisk_pull_4604&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=X0kuppcoBkurjGK5dhY1vViAOVizrmBkK-unFKRbRys&m=Omwt2ZmfdyerpXiU-HbIwPEvr7znKYAA4DFFhJiyk28&s=3z4nZkA573qZvgihbr448hMHPhnIC4zy7Y8MeuAENU0&e= > > > is a small change >>> that extends ActivationFileStorage. >>> >>> Please help and comment on the PR. >>> >>> Thank you, Ruediger >>> >>> > > > > -- > Regards, > James Thomas > > > > > > > > > >