Hello
I'm proud to share the information that all my planned integration tests pass!
The
readme.adoc grew too big - I'll try to change it to manual at some point. And to confluence wiki.
With Log4j2 I'm most satisfied:
- fragment sample contains @Plugin-s for filters, appenders and trigger policies
- there are tests using XML and properties syntax
- there are tests showing restarts and refreshes (just as with Log4J1 and Logback)
- the tests show that all 3 "backends" work very very consistently wrt configuration, EventAdmin integration, synchronization, OSGIPaxLoggingManager integration, fallback/default logger integration and switching between logging backends without a need to get Logger instance again
- the most important thing (IMO) is that ALL 11 (*eleven*) ways to print a log work exactly the same. All the below use single backend, single layout and consistent location info detection (previously, %C/%F/%L didn't work for direct use of org.osgi.service.log.LogService)
@Inject
private org.osgi.service.log.LogService osgiLogService;
@Inject
private org.knopflerfish.service.log.LogService fishLogService;
// 1. SLF4j
org.slf4j.LoggerFactory.getLogger(name).info("INFO using SLF4J");
// 2. Commons Logging
org.apache.commons.logging.LogFactory.getLog(name).info("INFO using Commons Logging");
// 3. JULI Logging
org.apache.juli.logging.LogFactory.getLog(name).info("INFO using Juli Logging");
// 4. Avalon Logging
org.ops4j.pax.logging.avalon.AvalonLogFactory.getLogger(name).info("INFO using Avalon Logging");
// 5. JBoss Logging
org.jboss.logging.Logger.getLogger(name).info("INFO using JBoss Logging");
// 6. Knopflerfish - no special facade
fishLogService.log(LogService.LOG_INFO, "INFO using Knopflerfish");
// 7. Log4J1
org.apache.log4j.Logger.getLogger(name).info("INFO using Log4Jv1");
// 8. Logback - only behind SLF4J
//
// 9. Log4J2
org.apache.logging.log4j.LogManager.getLogger(name).info("INFO using Log4Jv2");
// 10. JUL - extra handling without a pax-logging specific facade and shadowing. Only handler redirection
java.util.logging.Logger.getLogger(name).info("INFO using java.util.logging");
// 11. OSGi
osgiLogService.log(LogService.LOG_INFO, "INFO using LogService");
// 12. PaxLoggingService itself
ServiceReference<org.ops4j.pax.logging.PaxLoggingService> sr = context.getServiceReference(org.ops4j.pax.logging.PaxLoggingService.class);
org.ops4j.pax.logging.PaxLoggingService loggingService = context.getService(sr);
loggingService.log(LogService.LOG_INFO, "INFO using PaxLoggingService");
Here's full list of all 89 tests (previously: 2):
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.301 s - in org.ops4j.pax.logging.it.AllLoggingFacadesIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.258 s - in org.ops4j.pax.logging.it.CleanIntegrationTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.363 s - in org.ops4j.pax.logging.it.DefaultLogIntegrationTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.397 s - in org.ops4j.pax.logging.it.DefaultLogThresholdIntegrationTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.402 s - in org.ops4j.pax.logging.it.DefaultLogToFileSingletonIntegrationTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.613 s - in org.ops4j.pax.logging.it.Log4J1BuiltinAppendersIntegrationTest
[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.639 s - in org.ops4j.pax.logging.it.Log4J1IntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.491 s - in org.ops4j.pax.logging.it.Log4J1LocationInfoIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.470 s - in org.ops4j.pax.logging.it.Log4J1MDCIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.543 s - in org.ops4j.pax.logging.it.Log4J1OsgiAppendersIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.524 s - in org.ops4j.pax.logging.it.Log4J1OsgiErrorHandlersIntegrationTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.533 s - in org.ops4j.pax.logging.it.Log4J1OsgiLayoutsIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.480 s - in org.ops4j.pax.logging.it.Log4J1RefreshPaxLoggingApiIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.381 s - in org.ops4j.pax.logging.it.Log4J1RestartBothPaxLoggingBundlesIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.458 s - in org.ops4j.pax.logging.it.Log4J1RestartPaxLoggingApiIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.398 s - in org.ops4j.pax.logging.it.Log4J1RestartPaxLoggingServiceIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.409 s - in org.ops4j.pax.logging.it.Log4J1UpdateJULLoggerLevelsIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.473 s - in org.ops4j.pax.logging.it.Log4J1WithConfigAdminIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.359 s - in org.ops4j.pax.logging.it.Log4J1WithDefaultConfigurationAndNoLog4jDebugIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.361 s - in org.ops4j.pax.logging.it.Log4J1WithDefaultConfigurationIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.337 s - in org.ops4j.pax.logging.it.Log4J1WithoutEventAdminIntegrationTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.815 s - in org.ops4j.pax.logging.it.Log4J2BuiltinAppendersIntegrationTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.685 s - in org.ops4j.pax.logging.it.Log4J2IntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.867 s - in org.ops4j.pax.logging.it.Log4J2JacksonLayoutIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.604 s - in org.ops4j.pax.logging.it.Log4J2LocationInfoIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.782 s - in org.ops4j.pax.logging.it.Log4J2MDCIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.613 s - in org.ops4j.pax.logging.it.Log4J2MetaIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.499 s - in org.ops4j.pax.logging.it.Log4J2MetaNoLog4j2DebugIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.561 s - in org.ops4j.pax.logging.it.Log4J2OsgiAppendersIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.607 s - in org.ops4j.pax.logging.it.Log4J2RefreshPaxLoggingApiIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.563 s - in org.ops4j.pax.logging.it.Log4J2RestartBothPaxLoggingBundlesIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.544 s - in org.ops4j.pax.logging.it.Log4J2RestartPaxLoggingApiIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.504 s - in org.ops4j.pax.logging.it.Log4J2RestartPaxLoggingLog4J2ServiceIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.515 s - in org.ops4j.pax.logging.it.Log4J2UpdateJULLoggerLevelsIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.526 s - in org.ops4j.pax.logging.it.Log4J2WithConfigAdminIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.438 s - in org.ops4j.pax.logging.it.Log4J2WithDefaultConfigurationAndNoLog4j2DebugIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.456 s - in org.ops4j.pax.logging.it.Log4J2WithDefaultConfigurationIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.432 s - in org.ops4j.pax.logging.it.Log4J2WithoutEventAdminIntegrationTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.764 s - in org.ops4j.pax.logging.it.LogbackBuiltinAppendersIntegrationTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.481 s - in org.ops4j.pax.logging.it.LogbackIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.736 s - in org.ops4j.pax.logging.it.LogbackJacksonLayoutIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.544 s - in org.ops4j.pax.logging.it.LogbackLocationInfoIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.546 s - in org.ops4j.pax.logging.it.LogbackMDCIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.536 s - in org.ops4j.pax.logging.it.LogbackOsgiAppendersIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.635 s - in org.ops4j.pax.logging.it.LogbackRefreshPaxLoggingApiIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.445 s - in org.ops4j.pax.logging.it.LogbackRestartBothPaxLoggingBundlesIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.501 s - in org.ops4j.pax.logging.it.LogbackRestartPaxLoggingApiIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.518 s - in org.ops4j.pax.logging.it.LogbackRestartPaxLoggingLogbackIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.519 s - in org.ops4j.pax.logging.it.LogbackUpdateJULLoggerLevelsIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.443 s - in org.ops4j.pax.logging.it.LogbackWithConfigAdminIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.390 s - in org.ops4j.pax.logging.it.LogbackWithDefaultConfigurationAndNoLogbackDebugIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.405 s - in org.ops4j.pax.logging.it.LogbackWithDefaultConfigurationIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.345 s - in org.ops4j.pax.logging.it.LogbackWithoutEventAdminIntegrationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.288 s - in org.ops4j.pax.logging.it.SimplestPaxLoggingServiceIntegrationTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 89, Failures: 0, Errors: 0, Skipped: 0
regards
Grzegorz Grzybek