[Prev] Thread [Next]  |  [Prev] Date [Next]

Using environment variables in the config Alasdair Richardson Mon Sep 07 01:01:11 2009

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" />

This works fine (the log file is set up to be a combination of appname,
user, date etc)
  <!-- Set root logger -->
    <level value="${JCE_LOG_LEVEL}" />
    <!--level value="INFO" /-->
    <appender-ref ref="console" />
    <appender-ref ref="file" />

This doesn't - ie env var substitution does NOT seem to be used on the
'level' tag?
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.