[logback-user] Access Properties Defined in Logback programmatically
Charlie Hubbard
charlie.hubbard at gmail.com
Fri Jan 11 22:43:22 CET 2013
I have an administration console I'm building, and I want to display the
logs created in Logback for my application. However, where those logs are
stored is different per environment. I have several property files that
define where the logs are stored:
<configuration>
<property resource='log.properties'/>
<property resource='log.${ENV:-prod}.properties'/>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.dir}/sync.log</file>
...</configuration>
I'd like to find the value of ${log.dir} from Logback's Java API. I'd
tried the following, but it doesn't have any of the properties defined
in the resources. For example:
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
String logDir = loggerContext.getProperty("log.dir"); // this always
returns null
So my question is what API calls should I be using?
Thanks
Charlie
If you'd rather have the stackoverflow karma I originally posted this there:
http://stackoverflow.com/questions/14271253/access-properties-defined-in-logback-programmatically
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130111/bab567bd/attachment.html>
More information about the Logback-user
mailing list