Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6141843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:18:22+00:00 2026-05-23T18:18:22+00:00

The configuration file for logback gets found on the classpath, and is therefore Eclipse-project-specific,

  • 0

The configuration file for logback gets found on the classpath, and is therefore Eclipse-project-specific, which is not what I want. I’m using multiple Java utilities, all of them residing in a single project (this sharing the classpath), and I need to use a specific configuration for some of them.

I’ve tried variable substitution and Joram configurator, but nothing worked for me. This was most probably my fault, and I’m going to solve it one day, but for now I’d need a simple solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:18:23+00:00Added an answer on May 23, 2026 at 6:18 pm

    OPTION 1: specify the location of the logback configuration file with the logback.configurationFile system property. This does in fact allow you to have multiple configuration files per project. As per the logback documentation, the value of the this property can be a URL, a resource on the class path or a path to a file external to the application. For example:
    -Dlogback.configurationFile=/path/to/config.xml

    OPTION 2: use variable substitution to set the name of the log file with a system property. For example:

    1. Your appender can set the file as follows:
      <file>/var/tmp/${mycompany.myapplication}.log</file>
    2. And then you can specify the value of that variable when launching java:
      -Dmycompany.myapplication=SomeUtility

    OPTION 3: set the logger level with a system property. This will allow you to log more/less. For example:

    1. Put this into your logback config file:
      <logger name="com.mycompany" level="${mycompany.logging.level:-DEBUG}"/>
      This causes the specified package to log at DEBUG level by default.
    2. If you want to change the logging level to INFO in a specific application, then pass the following to java when launching that application:
      -Dmycompany.logging.level=INFO

    OPTION 4: add/remove an appender by passing a system property command-line parameter to java. This will allow you to log to different places. Note that conditional processing requires janino. For example:

    1. Put this into your logback config file wherever you would put an <appender-ref>, changing the ref value to one of your own <appender>s, of course:

      <if condition="property("mycompany.logging.console").equalsIgnoreCase("true")">
      <then><appender-ref ref="STDOUT"/></then></if>
    2. If you want to enable this appender, then pass the following to java when launching that application:
      -Dmycompany.logging.console=true

    Regarding system properties, you pass them to java as -D arguments, e.g.
    java -Dmy.property=/path/to/config.xml com.mycompany.MyMain

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using a configuration file I want to enable myself to turn on and off
I have a config file which lists all the configuration details for Logback.xml like
The configuration file C:\mywebapp\mydoamin.dll.config could not be found. mywebapp domain is the originating code.
I have a configuration file to which I want to add a string, that
I need to provide configuration file, which will describe which STL header files to
I'd like to use a configuration file format which supports key value pairs and
How do I know which configuration file is used by MySQL currently? Is there
I have the following logback.xml file: <configuration debug=true> <appender name=STDOUT class=ch.qos.logback.core.ConsoleAppender> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread]
This is the configuration file while hosting the service, here i hosted service using
I'm using a configuration file to route my requests in my application. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.