Java SE 7 Programmer II — Question 5
Which three principles are best practices when implementing a logging strategy for an enterprise application?
Answer options
- A. Never print log messages to the console window.
- B. Use the appropriate logger level for logging information.
- C. Log messages for every method entry and exit.
- D. Include programmer-specific data in the log messages.
- E. Include the thread name and Java class name in log messages.
Correct answer: B, C, D
Explanation
The correct answer options B, C, and D are essential for effective logging as they ensure that log messages are relevant, informative, and structured. Option A is incorrect because while printing to the console can be avoided in production, it is not a strict best practice for logging strategies. Option E, while useful, is not as critical as the chosen correct answers.