Niall,

Thanks for your response.  

-I configure Log4Net at startup in the Global.asax file with the
ConfigureAndWatch method.
-If I cause an error via the proxy, I receive the error and the email
subject appears as "AppName Exception - Log4Net Generated".  When I
cause the error not via the proxy I receive the error and the email
subject appears as "SERVERNAME AppName Exception - Log4Net Generated",
as it should.
-I ran a test as you requested, creating an aspx page with the following
command: <%=Environment.GetEnvironmentVariable("COMPUTERNAME")%>.  On
both the proxy and non-proxy calls, it correctly returned the value of
the COMPUTERNAME environment variable.  So it would seem this is limited
to Log4Net, not ASP.NET, but then again, who knows...

Thanks again,
Leo

-----Original Message-----
From: Niall Daley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 16, 2005 4:28 PM
To: Log4NET User
Subject: Re: COMPUTERNAME Environment Variable


Leo,
        You you supply some extra information:

- Are you configuring logging on every request, or just once on startup?
- If you cause an error via the proxy and one not via the proxy on the
same run do you get the same behaviour?
- Would you, in your code, try to access the COMPUTERNAME environment
variable in both these cases and see if it is set as you would expect.

                Niall Daley

On Mon, 14 Mar 2005, Hart, Leo wrote:

> Here's something I've come across that maybe someone else has seen:
>
> I've set up a RollingFileAppender:
>
>       <appender name="SMTP - Leo"
type="log4net.Appender.SMTPAppender">
>        <param name="To" value="[EMAIL PROTECTED]" />
>        <param name="From" value="[EMAIL PROTECTED]" />
>        <param name="Subject" value="${COMPUTERNAME} AppName Exception
-
> Log4Net Generated" />
>        <param name="SMTPHost" value="mailserver.mycompany.com" />
>        <param name="LocationInfo" value="false" />
>        <param name="BufferSize" value="1024" />
>        <param name="Lossy" value="true" />
>        <evaluator type="log4net.spi.LevelEvaluator">
>         <param name="Threshold" value="ERROR"/>
>        </evaluator>
>        <layout type="log4net.Layout.PatternLayout">
>         <param name="ConversionPattern" value="%-5p | %d{yyyy-MM-dd
> HH:mm:ss, fff} | %t | %X{vendorCode} | %X{adminID} | %X{sessionID} |
%c
> | %m%n" />
>        </layout>
>       </appender>
>
> To email me whenever an exception occurs in my application.  You'll 
> notice I'm using the COMPUTERNAME environment variable in the subject 
> line.  Whenever I hit the website directly, bypassing our proxy server

> and cause an error, I receive an email with the subject I expect:
>
>       SERVERNAME AppName Exception - Log4Net Generated
>
> However, if I go through our proxy server and create an error, I 
> receive an email with the following subject:
>
>       AppName Exception - Log4Net Generated
>
> So it would appear the COMPUTERNAME server variable is not being 
> recognized.  Does anyone have any idea why this would occur?  I've 
> noticed this behavior in all of our environments, QA, UAT and PRD.  
> I've ensured that all of the servers on each environment are 
> configured the same way.
>
> Thanks,
> Leo Hart
>
>

-- 
Niall Daley
Log4net Dev

Reply via email to