Solved

Log4j set log folder to program argument args[5]

Posted on 2011-03-07
3
287 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
ID: 35065702
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 58
sql import cannot be resolved jsp 3 50
Problem to Alipay 10 48
java mysql insert application 14 29
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

808 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