عرض عملي: من println إلى سجلات JSON مهيكلة
في هذا الدرس 3 موضوعات
محتوى هذا الدرس مكتوب وينتظر المراجعة. يعرض المخطط أدناه ما سيغطيه، وسيُنشر بعد اعتماده.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
replace println calls with SLF4J and JSON output. Prepares JNR-006-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Show Shop CLI with
System.out.printlndebugging. - Add SLF4J and Logback dependencies in the POM (verify versions before recording).
- Replace
printlnwithlog.infoand placeholders. - Planned mistake: log the card number in clear text, then spot it in the output. Fix: mask it with a helper and add a test.
- Switch the output to JSON through Logback configuration (a JSON encoder; verify the library).
- Trigger an error and show one stack trace, not two.
اختبر فهمك
What changed between text and JSON output?
أظهر الإجابة
Only the configuration.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.