The config will read environment variables in some places. I used this for a 
file name in an appender
 
 
  <appender name="file" type="log4net.Appender.FileAppender">
    <file value="${JCE_LOG_FILE}"/>
...
 
where JCE_LOG_FILE is an env var
 
Note thios doesnt seem to work everywhere since the follwoing did NOT work
 
 
  <root>
    <!-- Env var deosnt seem to work here, however the level will be 
overwritten in 
         JcEnvironment to whatever was in the table -->
    <!--level value="${JCE_LOG_LEVEL}" /-->
    <level value="INFO" />

Hope that helps


________________________________

        From: Alvarez Alvarez, Victor Manuel [mailto:[email protected]] 
        Sent: Thursday, September 10, 2009 3:02 PM
        To: [email protected]
        Subject: RollingLogFileAppender and custom remote File
        
        

        Hello,

        I have the next scenario, and I don't know how to do it.

         

        I need to use RollingLogFileAppender but the param name path file have 
to change in different environments. I would like the web.config file to be the 
same in 3 environments (TEST, PRE-PRODUCTION and PRODUCTION) and always write 
in the same remote server, but in different folder

         

        <appender name="RollingLogFileAppender" 
type="log4net.Appender.RollingFileAppender">

              <param name="File" 
value="\\RemoteLogServer\TEST\app1\logs\currentlog.config"/>

              <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

              <appendToFile value="true"/>

              <rollingStyle value="Date"/>

              <datePattern value="ddMMyyyy"/>

              <maxSizeRollBackups value="5"/>

              <maximumFileSize value="1MB"/>

              <filter type="log4net.Filter.LevelRangeFilter">

                <acceptOnMatch value="true"/>

                <levelMin value="DEBUG"/>

                <levelMax value="FATAL"/>

              </filter>

              <layout type="log4net.Layout.PatternLayout">

                <conversionPattern value="%-5p %d %5rms - %m%n"/>

              </layout>

            </appender>

         

        In PRO will be 

        <param name="File" 
value="\\RemoteLogServer\PRO\app1\logs\currentlog.config"/>

         

         

        ¿How can I configure this line for not to change when I deploy it?, 
with any pattern or anything

        For instance

        <param name="File" 
value="\\RemoteLogServer\[%ENV%]\app1\logs\currentlog.config"/>

         

         

        Best regards.

        Victor.

         

____________________________________
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.

Reply via email to