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 8199161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:06:54+00:00 2026-06-07T06:06:54+00:00

I would like to define some properties in my logback.xml config file and saw

  • 0

I would like to define some properties in my logback.xml config file and saw that by implementing the PropertyDefiner was a great way to set properties in a customizable way.

After starting to implement it I began to wonder how to access the value of the name attribute of the element within the tag. I’m not seeing anyway to do this and I’m scratching my head. Would this PropertyDefiner really make you create a new implementation for every single property? Why not just hard code it? I didn’t see much discussion about this out on the web.

I hope I’m just not seeing it and that the brains of stackoverflow can help me out. Does anyone know how to do this? Thanks!

I found this discussion: essentially the same question is asked, but no answer was returned.

fyi: I want to customize how I get my properties because I am pulling it from a database. I have a helper class which pulls the properties in on server startup. These properties vary based on environment (dev, test, prod, etc.)

  • 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-06-07T06:06:55+00:00Added an answer on June 7, 2026 at 6:06 am

    As of logback version 1.0.6, the value of the name attribute cannot be accessed directly. However, nothing prevents you from passing the value of the name attribute in a property of your choice. Example:

    <define name="rootLevel" class="Your.PropertyDefiner">
      <myKey>rootLevel</myKey>
    </define>
    

    where myKey is a property of Your.PropertyDefiner. For example:

    class Your.PropertyDefiner implements PropertyDefiner {   
      String myKey; 
      public void setMyKey(String k) {
        this.myKey= k;   
      }
      public String getPropertyValue() {
        return ...   
      }  
    }
    

    Joran, logback’s configuration framework, takes care of the wiring. Joran will inject the value of the myKey element into the myKey property of Your.PropertyDefiner. If you are curious about the technical details, see the documentation on implicit actions and implicit actions in practice.

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

Sidebar

Related Questions

I would like to define and initialize some variables in web.xml and the access
It's a bit odd but I would like to define some properties of a
I would like to define some kind of safe division (and modulo) function, one
I would like to export some macros that I have defined and be able
I would like to define a function that will be invoked from entry_32.S. It
I have a scenario where I would like to ignore some properties of classes
I'd like to define a trait with some properties which have a well defined
I would like to define properties for classes, and be able to access them
Can I do something like working-dir=file:${user.home}/some-directory within my .properties file? I am using ResourceBundle
I would like to define the following in Javascript: var tileXml = new Array();

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.