Using environment variables in the config

View: New views
1 Messages — Rating Filter:   Alert me  

Using environment variables in the config

by Alasdair Richardson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi
I am new to log4net (have used log4j etc). I wanted to set my config using environment variables, and have been having mixed success.
 
  <!-- file is set to be a FileAppender -->
  <appender name="file" type="log4net.Appender.FileAppender">
    <file value="${JCE_LOG_FILE}"/>
    <appendToFile value="false"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date{ISO8601} [%thread] %-5level %logger - %message%newline" />
    </layout>
  </appender>
This works fine (the log file is set up to be a combination of appname, user, date etc)
 
  <!-- Set root logger -->
  <root>
    <level value="${JCE_LOG_LEVEL}" />
    <!--level value="INFO" /-->
    <appender-ref ref="console" />
    <appender-ref ref="file" />
 
  </root>
This doesn't - ie env var substitution does NOT seem to be used on the 'level' tag?
 
Alasdair



____________________________________
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.