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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:46:53+00:00 2026-06-13T11:46:53+00:00

I have a log4j.xml config file. and a RollingFileAppender to which I need to

  • 0

I have a log4j.xml config file. and a RollingFileAppender to which I need to provide file path for storing logs. The problem is my code will be deployed on Unix machine as a runnable jar. So if I pass parameter something like this:

value=logs/messages.log"

it creates folder named logs inside my HOME directory and writes all the messages to file inside this directory.

I have a environmental variable set to some value. I want to use path of that variable and write messages under that path. How can I achieve it?

I had tried using this:

value="${MY_HOME}/logs/message.log"

but this does not work. Can anyone suggest a solution for this problem?

  • 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-13T11:46:54+00:00Added an answer on June 13, 2026 at 11:46 am

    When parsing its configuration file, the expression ${MY_HOME} will be expanded to the value of the system property named MY_HOME, not the system environment variable. There’s a difference between the two.

    To achieve this in a clean way, you’ll have to add something like this to the JVM invocation line:

    -DMY_HOME=$MY_HOME

    That would define the Java system property MY_HOME to contain the value of the environment variable MY_HOME.

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

Sidebar

Related Questions

I am currently watching an XML file from log4j output. I have a custom
I'm using apache commons library and log4j. I have an xml configuration file and
I have the following log4j.properties file: log4j.rootLogger=DEBUG,A1,A2,A3 log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.Threshold=DEBUG log4j.appender.A1.File=log.out log4j.appender.A1.MaxFileSize=100KB log4j.appender.A1.MaxBackupIndex=1 log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%p
I have an xml configuration file which works fine in Java, and I'm trying
I am writing Perl script. In that I have to read log4j.xml file from
I have the following in log4j.xml file, when I run my application. Only error
I have working web-application with applicationContext.xml in WEB-INF/config/applicationContext.xml. Now i need to implement some
I wanted to put my log4j.xml file in WEB-INF/conf directory where I have many
I am using Jboss5.1x I have configured jboss-log4j.xml so I will have a seperate
I have the following log4j.xml configuration: <log4j:configuration> <appender name = CONSOLE class = org.apache.log4j.ConsoleAppender>

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.