
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Platform Logging API in Java 9
In Java 9, Platform Logging API can be used to log messages with a service interface for consumers of those messages. An implementation of LoggerFinder has been loaded with the help of java.util.ServiceLoader API by using System ClassLoader. Based on this implementation, an application can plug in its own external logging backend without configuring java.util.logging.
We can pass a class name or module to LoggerFinder so that it knows which logger to return.
public class MyLoggerFinder extends LoggerFinder { @Override public Logger getLogger(String name, Module module) { // return a logger depends on name/module } }
If no concrete implementation can be found, then a default LoggerFinder implementation has been used. We obtain loggers that have created from LoggerFinder by using factory methods of the System class.
public class System { System.Logger getLogger(String name) { } System.Logger getLogger(String name, ResourceBundle bundle) { } }
Advertisements