BTP Application Logging Part 1: Why Logs Matter on BTP
Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.
Learn how BTP applications produce and store logs: log levels, structured JSON logs, the application logging/observability services for Cloud Foundry, dashboards for search, and the difference between application logs and Integration Suite message processing logs.
In this lessonShow sectionsHide sections
Visual overview
The situation: a real project scenario
A company's app failed intermittently, but only unstructured text logs existed and cf logs showed just recent lines. Binding a logging service and switching to structured JSON logs let support find failures in minutes.
Explanation
This series covers application logging across three parts: this first part explains why logs matter at all; part 2 covers configuring and consuming logging on Cloud Foundry; and part 3 covers correlation and troubleshooting across services. Applications write their logs to stdout and stderr, and BTP collects them — cf logs shows the most recent ones directly.
An application logging or observability service stores and indexes logs so they can actually be searched and put into dashboards; SAP Cloud Logging is the newer service for this, though it's worth checking what a given landscape actually has in place.
Structured, JSON-formatted logs with proper levels and correlation IDs are what make real analysis possible, rather than just scrolling through plain text. Integration Suite keeps its own separate set of message processing logs (MPL) for iFlows, distinct from application logs.
Logs aren't free storage, either in cost or in usefulness: setting log levels too verbose in production costs money and, just as importantly, buries the entries that actually matter under noise. It's worth deciding log levels per environment deliberately — DEBUG in development, INFO or WARN in production — rather than leaving the same level everywhere. Logging personal data or security tokens is also a direct violation of data protection rules, regardless of how useful it might seem for debugging.
A reasonable exercise is to check recent logs with cf logs, bind a proper logging service to the app, and then search for something specific in the resulting dashboard. The checkpoint is being able to find all of one request's log entries using its correlation ID.
Expert visual walkthrough
Operational diagnosis
Application Logging · Chapter-specific technical teaching map
Integration path
Business request
Application events
Central log stream
Troubleshooting
Tutor's chapter takeaway
Learn how BTP applications produce and store logs: log levels, structured JSON logs, the application logging/observability services for Cloud Foundry, dashboards for search, and the difference between application logs and Integration Suite message processing logs.
In a real project
A company's app failed intermittently, but only unstructured text logs existed and cf logs showed just recent lines. Binding a logging service and switching to structured JSON logs let support find failures in minutes.
Watch out for
• Unstructured logs. • DEBUG in prod. • Logging personal data. • Relying on cf logs only. • Ignoring MPL for iFlows.
Code example
===== QUICK LOOK =====cf logs my-app --recent // tails the app's recent stdout/stderr on Cloud FoundryStructured log line: {"level":"ERROR","msg":"Order save failed","correlation_id":"4f2a...","component":"orders-srv"} // JSON fields make the log machine-parseable and filterable by level/component/correlation_id ===== SOURCES =====App logs | app router access logs | platform events | Integration Suite MPL (Monitor → Message Processing) — each source covers a different layer of the stack, so a full trace often needs more than oneWatch out
Common mistakes
- Unstructured logs.
- DEBUG in prod.
- Logging personal data.
- Relying on cf logs only.
- Ignoring MPL for iFlows.
Do this
Best practices
- Structured logs.
- Right levels.
- Mask sensitive data.
- Use a logging service.
- Know MPL.
In the interview
Interview angle
Questions: "How are logs collected on BTP?", "Why structured logs?", "App logs vs MPL?"
Strong answer: sources, levels, structure, services, integration logs.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
Why are structured (JSON) logs preferred on BTP?
Question 2 of 3
During root-cause analysis, a developer wants to attach a custom text snippet (such as an intermediate variable value) to the Message Processing Log at a specific point in an integration flow's processing. Which Groovy script call is most appropriate?
Question 3 of 3
Which of the following best describes a key operational risk of leaving multiple production integration flows permanently set to Trace log level?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1What are the core concepts of Application Logging, and how would you explain them clearly in an SAP interview?
2Support can't diagnose intermittent failures in a BTP app because logs are unstructured and short-lived. What do you set up?
See it in code
Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.
Was this lesson helpful?
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.