Solved

Log4j set log folder to program argument args[5]

Posted on 2011-03-07
3
277 Views
Last Modified: 2012-05-11
Hello,

I'm required to create a jar of my application, instead of the batch file previously implemented.  The code I have written is now being integrated into a new environment where arguments and executable (i.e. jar) are defined in an xml file.

In the previous setup the log file was a VM argument, the log4j.properties file contained:

log4j.appender.rollingFile.File = ${logDir_var}/adapter.log

Now that's its inserted as a program argument I'm unsure how to set this.
0
Comment
Question by:AndyC1000
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
Comment Utility
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
Comment Utility
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>log4j.appender.rollingFile.File = ${logDir_var}/adapter.log

Just make sure that the env var is passed when you execute the jar - that's all you need to do:

java -DlogDir_var=foo -jar bar.jar

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now