Log4j Scala API provides a Scala-friendly interface to log against the Log4j API. It supports Scala 2.10, 2.11, 2.12, 2.13, and 3.

This is just a logging API. Your application still needs to have a logging backend (e.g., Log4j) configured.


You need to have the org.apache.logging.log4j:log4j-api-scala dependency in your classpath:

libraryDependencies ++= Seq(
  "org.apache.logging.log4j" %% "log4j-api-scala" % "13.1.0"

Java module name is set to org.apache.logging.log4j.api.scala. OSGi Bundle-SymbolicNames are set to org.apache.logging.log4j.api.scala.2.10, org.apache.logging.log4j.api.scala.2.11, and so on.


Using the Scala API is as simple as mixing in the Logging trait to your class:

import org.apache.logging.log4j.scala.Logging
import org.apache.logging.log4j.Level

class MyClass extends BaseClass with Logging {

  def doStuff(): Unit = {
    logger.info("Doing stuff")

  def doStuffWithLevel(level: Level): Unit = {
    logger(level, "Doing stuff with arbitrary level")

  def doStuffWithUser(user: User): Unit = {
    logger.info(s"Doing stuff with ${user.getName}.")


Parameter substitution

Unlike in Java, Scala provides native functionality for string interpolation beginning in Scala 2.10. As all logger calls are implemented as macros, using string interpolation directly does not require additional if checks:

logger.debug(s"Logging in user ${user.getName} with birthday ${user.calcBirthday}")

Logger names

Most logging implementations use a hierarchical scheme for matching logger names with logging configuration. In this scheme the logger name hierarchy is represented by . characters in the logger name, in a fashion very similar to the hierarchy used for Java/Scala package names. The Logger property added by the Logging trait follows this convention: the trait ensures the Logger is automatically named according to the class it is being used in.


Log4j Scala API uses GitHub for source code management.

The project requires two Java compilers to build:

  1. 8 (required for Scala 2.10 and 2.11)

  2. one matching the [17,18) range.

You can build and verify sources using:

./mvnw verify

You can build and view the website as follows:

./mvnw -N site
python -m http.server -d target/site


In accordance with the Apache Software Foundation’s release distribution policy and creation process, project artifacts are officially accessible from the following locations:

See the release instructions for details.

CycloneDX Software Bill of Materials (SBOM)

Starting with version 13.1.0, Log4j Scala API distributes CyclenoDX Software Bill of Materials (SBOM) along with each deployed artifact. This is streamlined by logging-parent, see its website for details.


Please keep in mind that this project is intended for internal usage only. You can use GitHub Issues for feature requests and bug reports – not questions! See the Log4j support policy for details.


If you have encountered an unlisted security vulnerability or other unexpected behaviour that has security impact, please report them privately to the Log4j security mailing list. See the Log4j Security page for further details.

Release Notes


Release date


This minor release contains a bug fix, Software Bill of Materials (SBOM) generation, and some dependency updates.


  • Start generating CycloneDX SBOM


  • Fix recursive inlining issues in Scala 3 macros (40)


  • Update org.apache.logging.log4j:log4j-bom to version 2.22.1 (43)

  • Update org.apache.logging:logging-parent to version 10.6.0 (44)


Release date


The highlights of this major release are Scala 3 support, OSGi and JPMS descriptors, and the switch to semantic versioning.

Note that this release is still binary backward compatible with the earlier release 12.0. Though we needed to bump the major version number for the semantic versioning switch to avoid the confusion related with version ordering.


  • Add support for Scala 3 (LOG4J2-3184, 26)

  • Add OSGi and JPMS support


  • Bump the Java version to 17 (Scala 2.10 and 2.11 targets still require Java 8 that build switches to using maven-toolchains-plugin)

  • Switch the CI to GitHub Actions

  • Switch from sbt to Maven to take advantage of logging-parent conveniences

  • Switch to semantic versioning

  • Update org.apache.logging.log4j:log4j-api version to 2.20.0

  • Update org.apache.logging:logging-parent to version 10.1.1

  • Start using log4j-changelog


Release date


This is the first release of the project.



  • Switch from sbt to Maven to take advantage of logging-parent conveniences (LOG4J2-1882)

  • Add release distribution script (LOG4J2-2303)

Release instructions

Log4j Scala API employs the CI/CD foundation provided by the logging-parent. You can simply use its release instructions.


Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See NOTICE.txt distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.