Apache | POI |
Home |
|
Apache POI - Logging FrameworkIntroduction#POI uses a custom logging framework which allows to configure where logs are sent to. Logging in POI is used only as a debugging mechanism, not a normal runtime logging system. Logging on level debug/info is ONLY for autopsie type debugging, and should NEVER be enabled on a production system. The framework is extensible so that you can send log messages to any logging framework that your application uses. A number of default logging implementations are supported by POI out-of-the-box and can be selected via a system property. Enable logging#By default, logging is disabled in POI. Sometimes it might be useful to enable logging to see some debug messages printed out which can help in analyzing problems. You can select the logging framework by setting the system property org.apache.poi.util.POILogger during application startup or by calling System.setProperty(): System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.CommonsLogger" ); Note: You need to call setProperty() before any POI functionality is invoked as the logger is only initialized during startup. Available logger implementations#The following logger implementations are provided by POI:
Sending logs to a different log framework#You can send logs to other logging frameworks by implementing the interface org.apache.poi.util.POILogger. Implementation details#Every class uses a POILogger to log, and gets it using a static method of the POILogFactory . Each class in POI can log using a POILogger, which is an abstract class. We decided to make our own logging facade because:
|