question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hey,

I’m trying to use the new Python runtime and managed to get to a point where I’m now running python 3.6.4, I managed to install dependencies via requirements.txt and my function runs. This was already quite a bit of trial and error.

However, I can’t seem to get the function to log anything to the output stream.

import json
import requests
import os

def main(req):
    postreqdata = json.loads(open(os.environ['req']).read())
    print(postreqdata)
    logger.info(postreqdata)
    logger.info("hey")

The output only shows

2018-03-13T04:17:31.125 [Info] Function started (Id=296e75cd-1cf1-45cd-80f9-9d8599513db6)

2018-03-13T04:17:33.297 [Info] Function completed (Success, Id=296e75cd-1cf1-45cd-80f9-9d8599513db6, Duration=2179ms)

Any pointers?

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:22 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
davidobrien1985commented, Mar 18, 2018

@1st1 sorry, took me a few days to get back to this. I also still don’t see any log output.

I created the Function via the portal by creating an “experimental python” function. All I did was follow the portal to create the function, nothing else. If the expectation is that users need to do more or something else then please remove the ability to create a python function via the UI.

1reaction
1st1commented, Mar 13, 2018

The PR has been merged to the dev branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Logging HOWTO — Python 3.11.1 documentation
Display console output for ordinary usage of a command line script or program · Report events that occur during normal operation of a...
Read more >
Logging in Python - Real Python
Learn why and how to get started with Python's powerful logging module to meet the needs ... The Logging Module; Basic Configurations; Formatting...
Read more >
Python Logging Basics - The Ultimate Guide To Logging
In the case of running Python in containers like Docker, logging to standard output is often the easiest move as this output can...
Read more >
Logging in Python - GeeksforGeeks
Python has a built-in module logging which allows writing status messages to a file or any other output streams. The file can contain...
Read more >
logging - Making Python loggers output all messages to stdout ...
All logging output is handled by the handlers; just add a logging.StreamHandler() to the root logger. Here's an example configuring a stream ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found