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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:31:30+00:00 2026-06-03T03:31:30+00:00

During a setup program, a configuration file (log4j.properties) needs to be modified. One line

  • 0

During a setup program, a configuration file (log4j.properties) needs to be modified.

One line of log4j.properties contains

log4j.appender.R.File=${catalina.base}/logs/OurProductWorker.log

We want it to be changedto

log4j.appender.R.File=${catalina.base}/logs/OurProductWorker5.log

(or some similar number)

This works:

sed -i 's/OurProductWorker.log/'"$1.log"'/g' "log4j.properties"

($1 = a number from 1 to 9 in the function called)

This fails:

B_PRODUCT=OurProduct 
sed -i 's/"$B_PRODUCT"Worker.log/'"$1.log"'/g' "log4j.properties"

I need to use a variable because we need to be to rebrand this for OEMs, and it’s obviously easier to just change a bunch of variables at the beginning of the script, rather than individual functions.

  • 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-03T03:31:32+00:00Added an answer on June 3, 2026 at 3:31 am

    Try this

    sed -i 's/'"$B_PRODUCT"'Worker.log/'"$1.log"'/g' "log4j.properties"
    

    You always have to ‘turn off’ the single-quotes to have variable expand (as you have done with $1).

    I hope this helps.

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

Sidebar

Related Questions

Inno Setup fails to remove components during uninstall cause my program is still running
I have Winforms application that must create write to certain configuration file during usage.
I'm trying to setup a repository in an ActiveCollab project. During setup, it reports
In the Setup Project I have 2 web.config files: web.config - used during the
I'm trying to setup NServiceBus in Azure. During local development I am using the
I currently have mirroring setup between three computers, principle, mirror, and witness. During the
During my NSIS setup script for a WinForms app, I use the following CACLS
During setup, I'm like missing vcvarsall.bat running build running build_py running build_ext building '_zope_interface_coptimizations'
I copied a SQL Server database from one system to the next, identical setup,
I need to write to the: C:\Users\user\AppData\Roaming\AppName folder during the setup process. I'm using

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.