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
_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to