I'm a bit new to Apache Openwhisk. It is an awesome project and I'm enjoying using, and learning it. Thank you so much for creating such an amazing project!
I'm not able to figure out the correct way to log from actions so I can see the logging output when an action is executed.
My logging config is:
import logging
dotenv.load_dotenv()
logging.basicConfig(
level="INFO",
format='%(asctime)s - %(name)s - %(levelname)s - %(threadName)s - %(message)s')
logger = logging.getLogger(__name__)
opensearch_logger = logging.getLogger("opensearch")
opensearch_logger.setLevel(logging.WARNING)
def handler(event):
logging.info(f"Some logging statement.")
return {"func": "fin"}
The action was executed successfully, but no logs showed up. Even if I add print statements;
{
"namespace": "whisk.system",
"name": "Test",
"version": "0.0.7",
"subject": "whisk.system",
"activationId": "7170dcb3cfbb4e60b0dcb3cfbb3e6035",
"start": 1738772766671,
"end": 1738772767450,
"duration": 779,
"statusCode": 0,
"response": {
"status": "success",
"statusCode": 0,
"success": true,
"result": {"func": "fin"}
},
**"logs": [],**
"annotations": [
{
"key": "path",
"value": "whisk.system/Test"
},
{
"key": "waitTime",
"value": 10
},
{
"key": "kind",
"value": "python:3.9"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
}
],
"publish": false
}
Am I missing something? Any advice would be deeply appreciated.
I'm a bit new to Apache Openwhisk. It is an awesome project and I'm enjoying using, and learning it. Thank you so much for creating such an amazing project!
I'm not able to figure out the correct way to log from actions so I can see the logging output when an action is executed.
My logging config is:
import logging
dotenv.load_dotenv()
logging.basicConfig(
level="INFO",
format='%(asctime)s - %(name)s - %(levelname)s - %(threadName)s - %(message)s')
logger = logging.getLogger(__name__)
opensearch_logger = logging.getLogger("opensearch")
opensearch_logger.setLevel(logging.WARNING)
def handler(event):
logging.info(f"Some logging statement.")
return {"func": "fin"}
The action was executed successfully, but no logs showed up. Even if I add print statements;
{
"namespace": "whisk.system",
"name": "Test",
"version": "0.0.7",
"subject": "whisk.system",
"activationId": "7170dcb3cfbb4e60b0dcb3cfbb3e6035",
"start": 1738772766671,
"end": 1738772767450,
"duration": 779,
"statusCode": 0,
"response": {
"status": "success",
"statusCode": 0,
"success": true,
"result": {"func": "fin"}
},
**"logs": [],**
"annotations": [
{
"key": "path",
"value": "whisk.system/Test"
},
{
"key": "waitTime",
"value": 10
},
{
"key": "kind",
"value": "python:3.9"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
}
],
"publish": false
}
Am I missing something? Any advice would be deeply appreciated.
Share Improve this question edited Feb 5 at 19:08 f_puras 2,5054 gold badges35 silver badges45 bronze badges asked Feb 5 at 16:42 Akshay RamAkshay Ram 197 bronze badges1 Answer
Reset to default 0Have you tried logging to stdout with print
? It could be your logger - is it configured to write to stdout? Also try adding a logger flush.