blob: 11d4dc79dbcfde1d1f1bd0474948e309b597ef5e [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Apache Felix Logback :: Apache Felix</title>
<link rel="canonical" href="https://felix.apache.org/documentation/subprojects/apache-felix-logback.html">
<meta name="generator" content="Antora 2.3.4">
<link rel="stylesheet" href="../../_/css/site.css">
<link rel="icon" href="../../_/img/favicon.png" type="image/x-icon">
</head>
<body class="article">
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="https://felix.apache.org/index.html">
<span>
<img src="../../_/img/logo.png">
</span>
</a>
<button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button>
</div>
<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<a class="navbar-item" href="https://felix.apache.org/index.html">Home</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Subprojects</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="apache-felix-dependency-manager.html">Dependency Manager</a>
<a class="navbar-item" href="apache-felix-event-admin.html">Event Admin</a>
<a class="navbar-item" href="apache-felix-file-install.html">File Install</a>
<a class="navbar-item" href="apache-felix-framework.html">Framework</a>
<a class="navbar-item" href="apache-felix-gogo.html">Gogo Shell</a>
<a class="navbar-item" href="apache-felix-healthchecks.html">Health Checks</a>
<a class="navbar-item" href="apache-felix-inventory.html">Inventory</a>
<a class="navbar-item" href="apache-felix-log.html">Log</a>
<a class="navbar-item" href="apache-felix-logback.html">Logback</a>
<a class="navbar-item" href="apache-felix-maven-bundle-plugin.html">Maven bundle plugin</a>
<a class="navbar-item" href="apache-felix-maven-scr-plugin.html">Maven SCR plugin</a>
<a class="navbar-item" href="apache-felix-metatype-service.html">Metatype Service</a>
<a class="navbar-item" href="apache-felix-preferences-service.html">Preferences Service</a>
<a class="navbar-item" href="apache-felix-remote-shell.html">Remote Shell</a>
<a class="navbar-item" href="apache-felix-script-console-plugin.html">Script console plugin</a>
<a class="navbar-item" href="apache-felix-shell.html">Lightweight shell</a>
<a class="navbar-item" href="apache-felix-shell-tui.html">Shell TUI</a>
<a class="navbar-item" href="apache-felix-web-console.html">Web Console</a>
</div>
</div>
<div class="navbar-item">
<span class="control">
<a class="button is-primary" href="../downloads.html">Downloads</a>
</span>
</div>
</div>
</div>
</nav>
</header>
<div class="body">
<div class="nav-container" data-component="documentation" data-version="master">
<aside class="nav">
<div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
<h3 class="title"><a href="../index.html">Documentation</a></h3>
<ul class="nav-list">
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../documentation.html">Documentation</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../downloads.html">Downloads</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../getting-started.html">Getting Started</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../news.html">News</a>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<span class="nav-text">Community</span>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../community/project-info.html">Apache Felix Project Info</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../community/contributing.html">Contributing</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../community/projects-using-felix.html">Projects Using Felix</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<span class="nav-text">Development</span>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../development/coding-standards.html">Coding Standards</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../development/dependencies-file-template.html">DEPENDENCIES file template</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../development/provisional-osgi-api-policy.html">Provisional OSGi API Policy</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../development/release-management-nexus.html">Release Management</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../development/site-how-to.html">Site How To</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../development/using-the-osgi-compliance-tests.html">Using the OSGi Compliance Tests</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../faqs.html">FAQS</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../faqs/apache-felix-bundle-plugin-faq.html">Apache Felix Bundle Plugin Frequently Asked Questions</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../faqs/apache-felix-scr-plugin-faq.html">Apache Felix SCR Plugin Frequently Asked Questions</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../subprojects.html">Subprojects</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="apache-felix-dependency-manager.html">Apache Felix Dependency Manager</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<button class="nav-item-toggle"></button>
<span class="nav-text">Guides</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/migrating-from-earlier-versions.html">Apache Felix Dependency Manager - Migrating from earlier versions</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/annotations.html">Dependency Manager - Annotations</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/background.html">Dependency Manager - Background</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/bundles-and-dependencies.html">Dependency Manager - Bundles and Dependencies</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/design-patterns.html">Dependency Manager - Design Patterns</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/development.html">Dependency Manager - Development</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/history.html">Dependency Manager - History</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/javadocs.html">Dependency Manager - JavaDocs</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/migrating-from-other-solutions.html">Dependency Manager - Migrating from other solutions.</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/performance-tuning.html">Dependency Manager - Performance Tuning</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/resources.html">Dependency Manager - Resource adapters</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/whatsnew.html">Dependency Manager - What&#8217;s new in version 4?</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/dm-lambda.html">Dependency Manager Lambda</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/guides/whatsnew-r15.html">What&#8217;s New in R15</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<button class="nav-item-toggle"></button>
<span class="nav-text">Reference</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/component-adapter.html">Dependency Manager - Adapter</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/component-aspect.html">Dependency Manager - Aspect</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/component-bundle-adapter.html">Dependency Manager - Bundle Adapter</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/dependency-bundle.html">Dependency Manager - Bundle Dependency</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/components.html">Dependency Manager - Components</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/dependency-configuration.html">Dependency Manager - Configuration Dependency</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/dependencies.html">Dependency Manager - Dependencies</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/external-links.html">Dependency Manager - External Links</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/component-factory-configuration-adapter.html">Dependency Manager - Factory Configuration Adapter Service</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/component-resource-adapter.html">Dependency Manager - Resource Adapter</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/dependency-resource.html">Dependency Manager - Resource Dependency</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/dependency-service.html">Dependency Manager - Service Dependency</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/service-scopes.html">Dependency Manager - Service Scopes</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/component-singleton.html">Dependency Manager - Singleton Component</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/thread-model.html">Dependency Manager - Thread Model</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/reference/dm-annotations.html">Dependency Manager Annotations</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<button class="nav-item-toggle"></button>
<span class="nav-text">Tutorials</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/tutorials/working-with-annotations.html">Dependency Manager - Annotations</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/tutorials/getting-started.html">Dependency Manager - Getting Started</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/tutorials/leveraging-the-shell.html">Dependency Manager - Leveraging the shell</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-dependency-manager/tutorials/sample-code.html">Dependency Manager sample projects</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-event-admin.html">Apache Felix Event Admin</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-file-install.html">Apache Felix File Install</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="apache-felix-framework.html">Apache Felix Framework</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-framework/apache-felix-framework-bundle-cache.html">Apache Felix Framework Bundle Cache</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-framework/apache-felix-framework-configuration-properties.html">Apache Felix Framework Configuration Properties</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-framework/apache-felix-framework-faq.html">Apache Felix Framework Frequently Asked Questions</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-framework/apache-felix-framework-launching-and-embedding.html">Apache Felix Framework Launching and Embedding</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-framework/apache-felix-framework-usage-documentation.html">Apache Felix Framework Usage Documentation</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-framework-security.html">Apache Felix Framework Security</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="apache-felix-gogo.html">Apache Felix Gogo</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-gogo/rfc-147-overview.html">RFC 147 Overview</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-healthchecks.html">Apache Felix Health Checks</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-inventory.html">Apache Felix Inventory Printer</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-log.html">Apache Felix Log</a>
</li>
<li class="nav-item is-current-page" data-depth="2">
<a class="nav-link" href="apache-felix-logback.html">Apache Felix Logback</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-maven-bundle-plugin-bnd.html">Apache Felix Maven Bundle Plugin (BND)</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-metatype-service.html">Apache Felix Metatype Service</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-osgi-bundle-repository.html">Apache Felix OSGi Bundle Repository (OBR)</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-preferences-service.html">Apache Felix Preferences Service</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-remote-shell.html">Apache Felix Remote Shell</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-shell.html">Apache Felix Shell</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="apache-felix-shell-tui.html">Apache Felix Shell TUI</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="apache-felix-web-console.html">Apache Felix Web Console</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-web-console/extending-the-apache-felix-web-console.html">Extending the Apache Felix Web Console</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-web-console/web-console-restful-api.html">Web Console RESTful API</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-web-console/web-console-security-provider.html">Web Console Security Provider</a>
</li>
<li class="nav-item" data-depth="3">
<button class="nav-item-toggle"></button>
<span class="nav-text">Extensions</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-web-console/extending-the-apache-felix-web-console/branding-the-web-console.html">Branding the Web Console</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-web-console/extending-the-apache-felix-web-console/providing-resources.html">Providing Resources</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-web-console/extending-the-apache-felix-web-console/providing-web-console-plugins.html">Providing Web Console Plugins</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-web-console/extending-the-apache-felix-web-console/web-console-logging.html">Web Console Logging</a>
</li>
<li class="nav-item" data-depth="4">
<a class="nav-link" href="apache-felix-web-console/extending-the-apache-felix-web-console/web-console-output-templating.html">Web Console Output Templating</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<span class="nav-text">Maven SCR plugin</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-maven-scr-plugin/apache-felix-maven-scr-plugin-use.html">Apache Felix Maven SCR Plugin Use</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-maven-scr-plugin/apache-felix-scr-bndtools-use.html">Apache Felix SCR Annotations BndTools Use</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-maven-scr-plugin/apache-felix-scr-ant-task-use.html">Apache Felix SCR Ant Task Use</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-maven-scr-plugin/extending-scr-annotations.html">Extending SCR Annotations Excerpt: How add new Annotations extending the base Annotations</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-maven-scr-plugin/scr-annotations.html">SCR Annotations Excerpt: Using Java 5 Annotations to describe the component or service.</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="apache-felix-maven-scr-plugin/scr-javadoc-tags.html">SCR JavaDoc Tags Excerpt: Using JavaDoc Tags to describe the component or service.</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../tutorials-examples-and-presentations.html">Tutorials</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-application-demonstration.html">Apache Felix Application Demonstration</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial.html">Apache Felix OSGi Tutorial</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-faq.html">OSGi Frequently Asked Questions</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<span class="nav-text">OSGI Tutorial</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-1.html">Apache Felix Tutorial Example 1 - Service Event Listener Bundle</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-2.html">Apache Felix Tutorial Example 2</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-2b.html">Apache Felix Tutorial Example 2b</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-3.html">Apache Felix Tutorial Example 3</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-4.html">Apache Felix Tutorial Example 4</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-5.html">Apache Felix Tutorial Example 5</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-6.html">Example 6 - Spell Checker Service Bundle</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-7.html">Example 7 - Spell Checker Client Bundle</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-8.html">Example 8 - Spell Checker Service using Service Binder</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-9.html">Example 9 - Spell Checker Service using Declarative Services</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../license.html">Apache License 2.0</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../site-map.html">Site map</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
<div class="context">
<span class="title">Documentation</span>
<span class="version">master</span>
</div>
<ul class="components">
<li class="component is-current">
<span class="title">Documentation</span>
<ul class="versions">
<li class="version is-current is-latest">
<a href="../index.html">master</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
<a href="../index.html" class="home-link"></a>
<nav class="breadcrumbs" aria-label="breadcrumbs">
<ul>
<li><a href="../index.html">Documentation</a></li>
<li><a href="../subprojects.html">Subprojects</a></li>
<li><a href="apache-felix-logback.html">Apache Felix Logback</a></li>
</ul>
</nav>
<div class="edit-this-page"><a href="https://github.com/apache/felix-antora-site/edit/main/modules/ROOT/pages/subprojects/apache-felix-logback.adoc">Edit this Page</a></div>
</div>
<div class="content">
<article class="doc">
<h1 class="page">Apache Felix Logback</h1>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p><strong>Apache Felix Logback</strong> is a small integration of the <a href="https://logback.qos.ch/">Logback</a> backend with OSGi.</p>
</div>
<div class="paragraph">
<p>With <strong>OSGi R7</strong> the <strong>Log Service Specification 1.4</strong> (Log 1.4) brings a slew of new features designed to improve the developer experience with logging, the details of which can be read about <a href="https://osgi.org/specification/osgi.cmpn/7.0.0/service.log.html">here</a>.</p>
</div>
<div class="paragraph">
<p>This project is intended to help bridge the last frontier of OSGi logging by leveraging many capabilities of <a href="https://logback.qos.ch/">Logback</a>, the new <strong>Log 1.4</strong> features to provide a <strong>unified backend</strong> where:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>all logging <em>can be</em> configured in one place</p>
</li>
<li>
<p>all log records are appended together (or at least all appenders are setup in one place)</p>
</li>
<li>
<p>support as many logging APIs as possible</p>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_depedencies"><a class="anchor" href="#_depedencies"></a>Depedencies</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To add Logback to an OSGi framework include the following dependencies</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"> &lt;dependency&gt;
&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
&lt;version&gt;1.2.x&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
&lt;artifactId&gt;logback-core&lt;/artifactId&gt;
&lt;version&gt;1.2.x&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
&lt;version&gt;1.7.x&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>These provide the <code>slf4j</code> logging API over the Logback backend.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_basic_configuration"><a class="anchor" href="#_basic_configuration"></a>Basic Configuration</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Configuring logback is easily handled by setting the system property <code>logback.configurationFile</code> to point to a file on the file system.</p>
</div>
<div class="paragraph">
<p>This is an example using a <em>bndrun</em> file:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-properties hljs" data-lang="properties"> -runproperties: logback.configurationFile=${fileuri;${.}/logback.xml}</code></pre>
</div>
</div>
<div class="paragraph">
<p>where the bnd macro <code>${.}</code> gives the path to the directory of the bndrun file and macro <code>${fileuri;&lt;path&gt;}</code> converts the path to a system compatible path.</p>
</div>
<div class="paragraph">
<p>Logback offers many features from it&#8217;s configuration file, so make sure to look through the <a href="https://logback.qos.ch/documentation.html">documentation</a>.</p>
</div>
<div class="paragraph">
<p><strong>Note</strong> When using the bnd export function to produce an executable jars <code>-runproperties</code> are copied verbatim and as defined above the property will be the literal value provided at build time.
This is likely not desirable.
You can instead use a path without a URI protocol to ensure logback searches for the file on the classpath of the executable jar.</p>
</div>
<div class="paragraph">
<p>A default configuration file can be embedded in the executable jar with the <code>-includeresource</code> directive in the bndrun file:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>::properties
-includeresource: META-INF/logback.xml=${.}/logback.xml</pre>
</div>
</div>
<div class="paragraph">
<p>This places the default logback config inside the executable jar at <code>META-INF/logback.xml</code>.
Now the following directive can be used:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-properties hljs" data-lang="properties"> -runproperties: logback.configurationFile=META-INF/logback.xml</code></pre>
</div>
</div>
<div class="paragraph">
<p>The defaults will be used when executing the jar.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash"> java -jar executable.jar</code></pre>
</div>
</div>
<div class="paragraph">
<p>Of course this property can be overloaded by the system property when executing the jar:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash"> java -jar executable.jar -Dlogback.configurationFile=file:/some/path/logback.xml</code></pre>
</div>
</div>
<div class="paragraph">
<p>Remember to use the <code>file:</code> protocol in this case to alert logback to the fact this path is not on the classpath.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_deployment_options"><a class="anchor" href="#_deployment_options"></a>Deployment Options</h2>
<div class="sectionbody">
<div class="paragraph">
<p>There are at least two possible deployment scenarios.</p>
</div>
<div class="sect2">
<h3 id="_the_standard_approach"><a class="anchor" href="#_the_standard_approach"></a>The Standard Approach</h3>
<div class="paragraph">
<p>The <strong>standard approach</strong> is to install all bundles into the OSGi runtime.</p>
</div>
<div class="paragraph">
<p><strong>pros</strong>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>this is the most understood and expected deployment scenario</p>
</li>
<li>
<p>bundles are managed through any OSGi management agent</p>
</li>
</ul>
</div>
<div class="paragraph">
<p><strong>cons</strong>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>due to the fact that logging APIs are most commonly static there is an inevitable race condition which is exacerbated by aspects such as:</p>
<div class="ulist">
<ul>
<li>
<p>the order in which the bundles are started</p>
</li>
<li>
<p>which bundle makes the first call the static API that most-likely has the side effect of binding an implementation</p>
</li>
<li>
<p>buffering is required to collect the complete set of logs, but configuring the buffer to hold that many logs can cause memory issues, or if too small to lose records.
Also, some logging frameworks simply don&#8217;t provide such buffering, and some actually simply fail in this scenario.
In the case of the OSGi Log Service this is handled by implementations that support Log 1.4, or perhaps earlier through proprietary means.</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="_the_immediate_approach"><a class="anchor" href="#_the_immediate_approach"></a>The Immediate Approach</h3>
<div class="paragraph">
<p>The <strong>immediate approach</strong> overcomes the <strong>cons</strong> of <em>the standard approach</em> and initializes the log engine as early as possible in order to avoid buffering, binding issues, or losing records.</p>
</div>
<div class="paragraph">
<p><strong>pros</strong>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>there&#8217;s very little chance to miss any log records</p>
</li>
<li>
<p>there are no temporal issues for binding or bundle start order since the log engine is setup before most other application activities take place</p>
</li>
</ul>
</div>
<div class="paragraph">
<p><strong>cons</strong>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>bundles on the framework class path are not installed into the framework so they cannot be managed through regular means.
<em>On the other hand, logging is one of those infrastructural aspects that transcends the application and for which there are very few scenarios under which one would want to manage logging API or implementation bundles this way.
Configuration?
Sure!</em></p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_unified_backend"><a class="anchor" href="#_unified_backend"></a>Unified Backend</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Of course adding Logback does not magically result in all logs being funneled into the same appenders, particularly the OSGi logs.
However, it is quite common to assemble an OSGi application from a variety of bundles which use a variety of logging APIs.
Many of these can already be mapped onto Logback.</p>
</div>
<div class="paragraph">
<p>Many examples of setting up the various logging APIs can be found in the integration tests of the project.</p>
</div>
<div class="paragraph">
<p>The following APIs are tested:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>JBoss Logging 3.3.x</p>
</li>
<li>
<p>Commons Logging 1.2</p>
</li>
<li>
<p>JUL (Java Util Logging)</p>
</li>
<li>
<p>Log4j 1</p>
</li>
<li>
<p>Log4j 2</p>
</li>
<li>
<p>Slf4j</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_mapping_of_osgi_events"><a class="anchor" href="#_mapping_of_osgi_events"></a>Mapping of OSGi Events</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The OSGi Log specification 1.4 describes events resulting in log records.
<strong>Log 1.4</strong> defines logger names mapping to these events.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Event</th>
<th class="tableblock halign-left valign-top">Logger Name</th>
<th class="tableblock halign-left valign-top">Events types</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Bundle event</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Events.Bundle</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INSTALLED</code> - BundleEvent INSTALLED + <code>STARTED</code> - BundleEvent STARTED + <code>STOPPED</code> - BundleEvent STOPPED + <code>UPDATED</code> - BundleEvent UPDATED + <code>UNINSTALLED</code> - BundleEvent UNINSTALLED + <code>RESOLVED</code> - BundleEvent RESOLVED + <code>UNRESOLVED</code> - BundleEvent UNRESOLVED</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Service event</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Events.Service</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>REGISTERED</code> - ServiceEvent REGISTERED + <code>MODIFIED</code> - ServiceEvent MODIFIED + <code>UNREGISTERING</code> - ServiceEvent UNREGISTERING</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Framework event</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Events.Framework</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>STARTED</code> - FrameworkEvent STARTED + <code>ERROR</code> - FrameworkEvent ERROR + <code>PACKAGES_REFRESHED</code> - FrameworkEvent PACKAGES REFRESHED + <code>STARTLEVEL_CHANGED</code> - FrameworkEvent STARTLEVEL CHANGED + <code>WARNING</code> - FrameworkEvent WARNING + <code>INFO</code> - FrameworkEvent INFO</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Legacy Log Service events</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LogService</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">any log events originating from bundles that used the original <code>LogService</code> logging API</p></td>
</tr>
</tbody>
</table>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
In order to improve the granularity of the logging associated with these events, <strong>Apache Felix Logback</strong> allows appending a period (<code>.</code>) followed by any number of segments (separated by periods) of the <code>Bundle-SymbolicName</code> for the logger names used in configuring the levels.
This greatly improves the configurability.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Consider the following <code>logback.xml</code> example:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml">&lt;configuration&gt;
&lt;!-- defined a console append --&gt;
&lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt;
&lt;encoder&gt;
&lt;pattern&gt;%d{HH:mm:ss.SSS} [%.15thread] %-5level %logger{36}:%line - %msg%n&lt;/pattern&gt;
&lt;/encoder&gt;
&lt;/appender&gt;
&lt;!-- log all Bundle events --&gt;
&lt;logger name="Events.Bundle" level="TRACE"/&gt;
&lt;!-- log WARN Framework service events of bundles whose BSN starts with `org.eclipse.osgi` (guess who that is?) --&gt;
&lt;logger name="Events.Service.org.eclipse.osgi" level="WARN"/&gt;
&lt;!-- turn OFF legacy Log Service records from bundles whose BSN starts with `org.baz` --&gt;
&lt;logger name="LogService.org.baz" level="OFF"/&gt;
&lt;!-- log DEBUG Service events for bundles whose BSN starts with `org.fum` --&gt;
&lt;logger name="Events.Service.org.fum" level="DEBUG"/&gt;
&lt;!-- log DEBUG from any log API using a logger name starting with `org.my.foo` --&gt;
&lt;logger name="org.my.foo" level="DEBUG"/&gt;
&lt;root level="ERROR"&gt;
&lt;appender-ref ref="STDOUT" /&gt;
&lt;/root&gt;
&lt;/configuration&gt;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_notes"><a class="anchor" href="#_notes"></a>Notes</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p><strong>Apache Felix Logback</strong> supports Logback&#8217;s <a href="https://logback.qos.ch/manual/configuration.html#autoScan">automatic reloading</a> upon file modification</p>
</li>
<li>
<p>When using <strong>equinox</strong> framework you may want to disable it&#8217;s internal appenders using the system property <code>eclipse.log.enabled=false</code></p>
</li>
</ul>
</div>
</div>
</div>
</article>
<aside class="toc sidebar" data-title="Contents" data-levels="2">
<div class="toc-menu"></div>
</aside>
</div>
</main>
</div>
<footer class="footer">
<p>Content licensed under AL2. UI licensed under MPL-2.0 with extensions licensed under AL2</p>
</footer>
<script src="../../_/js/site.js"></script>
<script async src="../../_/js/vendor/highlight.js"></script>
</body>
</html>