Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j question

 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have the following defined log4j.xml



if i want to prepend /home/myid in front of log/test.log before the test.log is created and logged. how do i do it before the log4j start to write to the log file? thanks.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
luri ron wrote:i have the following defined log4j.xml



if i want to prepend /home/myid in front of log/test.log before the test.log is created and logged. how do i do it before the log4j start to write to the log file? thanks.


I might be confused here but why don't you just declare:

 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using my magic 8 ball I am guessing what you are looking for...

You can use system properties to specify the log directory see recent log4j post I answered with question about how to specify the log dir from the environment.

You can do the whole thing programmatically instead of using the properties or xml file and specify the log dir however you like then.

Or you can clarify the question.

 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using system property is what i needed.

the purpose is to allowed each user to start their program from anywhere and can specify where to write the log to through the start up script. thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic