?
Solved

Log4j set log folder to program argument args[5]

Posted on 2011-03-07
3
Medium Priority
?
295 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 1000 total points
ID: 35065702
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 35065716
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35068020
>>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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month16 days, 22 hours left to enroll

864 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