hmcguirk
hmcguirk3mo ago

Logging Best Practices

Hi. I'm working on my first Actor, to understand capabilities of the platform before I build some real Actors. Can someone explain some recommendations around logging? I have my docker container that writes to console. I can see that in Apify so all good. But, for example, if a customer runs my Actor, will they always see exactly the same output I see? I would expect public runs to not include sensitive data, but I would like to see that when I run myself. E.g an exception thrown or error returned by a library I use. I do not want sensitive error details, code/files/line numbers or internal details in the customer's logs, but I would expect them in mine. Can I enforce different log levels for customers vs myself? Maybe this all comes down to: can I configure different environment variables for customers vs myself that can't be overridden by the customer?
3 Replies
hmcguirk
hmcguirkOP3mo ago
I can see the 'APIFY_USER_ID' env variable. That would let me distinguish me vs not-me, but seems like a bit of a hack
hmcguirk
hmcguirkOP3mo ago
OK thanks. So the idea here would be to manually change the log level env variable to Debug when I run it myself, if I want extra details. And a customer would be unable to set that variable. That could work except I was hoping to automatically have a different log level for myself, without the manual step. Thanks for the help 👍

Did you find this page helpful?