Externalize log4j.properties in Windows

This article describes the steps to externalize the log4j.properties file for the OvalEdge application deployed on Apache Tomcat in a Windows environment. Externalizing the logging configuration enables updates to log levels, appenders, and file locations without redeploying the application. This approach supports easier maintenance and environment-specific configurations.

Prerequisites

Ensure the following conditions are met before proceeding:

  • Access to the Windows server hosting the OvalEdge application

  • Administrative permissions to modify Apache Tomcat configuration and restart services

  • Apache Tomcat installation (for example: C:\ovaledge\apache-tomcat-10.1.40)

  • Java runtime installed and configured

  • Text editor (for example: Notepad++, VS Code, or Notepad)

Configuration Steps

  1. Access the Application Server

    • Access the Windows server using Remote Desktop Protocol (RDP) or console access.

      Sample Reference Screenshot

  2. Create External Configuration Directory and Copy File

    • Open Command Prompt or PowerShell with administrative privileges.

    • Create the external configuration directory:

      mkdir C:\ovaledge\extprop

      Sample Reference Screenshot

    • Place the log4j.properties file in the following directory:

      C:\ovaledge\extprop\log4j.properties

      Sample Reference Screenshot

  3. Modify the External log4j.properties File

    • Open the file:

      C:\ovaledge\extprop\log4j.properties

    • Update logging properties based on requirements. Example:

      #log4j.rootLogger=INFO, CONSOLE
      log4j.rootLogger=INFO, FILE

      Sample Reference Screenshot

  4. Configure Tomcat to Use External log4j.properties

    • Navigate to the Tomcat bin directory:

      C:\ovaledge\apache-tomcat-10.1.40\bin
    • Open the Tomcat service configuration from this directory. Sample Reference Screenshot

    • In the Java tab, add the following parameter under Java Options:

      -Dlog4j.configuration=file:C:\path\to\extprop\log4j.properties

      Sample Reference Screenshot

  5. Restart Apache Tomcat

    • Restart Apache Tomcat to apply the configuration changes.

    • If running as a Windows service, restart using Services (services.msc) or command-line tools. Sample Reference Screenshot


Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.

Last updated

Was this helpful?