On Aug 14, 2008, at 11:08 PM, Scott Heaberlin wrote:

Great idea, Paul.  Following your idea, I also had to take the
following steps (posted here to leave an answer in the archives):

- use ${log4j.user.home} in my log4j.properties
- in my main() method, *very first* I obtain
System.getProperty("user.home") and .replace('\\', '/') in it, sending
the result to System.setProperty("log4j.user.home", ...)
- In my main-class, change the Logger definition from static final to
simply an object property.  For me, I was able to do this without much
recourse because my main-class is effectively a singleton anyway.  I
had to prevent log4j from initializing at class load of
MyMainClass.class (from the Logger declaration).

Thanks again,

-Scott Heaberlin


Seems to be running into bug 22894 (http://issues.apache.org/bugzilla/show_bug.cgi?id=22894 ). Unfortunately, there is not an easy way to always do the right thing for backslashes in configuration files themselves since some users may have compensated or depended on the existing behavior so "fixing" the behavior would break those applications, hence the bug is marked WONTFIX.

There is a possibility that you could escape the backslashes (either convert or double) for properties that are known to be file paths $ {user.home}, ${user.dir}, ${java.io.tmpdir}. Still the possibility that it would break apps that compensated for the existing behavior.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to