logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <psm...@aconex.com>
Subject Re: Variable expansion in PropertyConfigurator
Date Fri, 15 Aug 2008 03:39:35 GMT
>
> The only workaround I can think of is to subclass FileAppender, give
> it a setter method called setSystemPropertyDirPrefix, then in
> log4j.properties refrain from File=${user.home}.  Instead, I'd use
> SystemPropertyDirPrefix=user.home (no variable) and within the coded
> FileAppender subclass do the System.getProperty() lookup.
>

Tricky.  One other suggestion is to at startup create a new System  
Property variable (before log4j starts, say 'log4config.user.home')  
that is based on the value of ${user.home} and do the 'unescaping' by  
changing '\'->'/' (if on Windows?).  Java has now long supported '/'  
as a valid path on all platforms, so "C:/Documents and Settings/ 
username" works fine.

cheers,

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message