?
Solved

Log4j set log folder to program argument args[5]

Posted on 2011-03-07
3
Medium Priority
?
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 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