Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

Mohkam Singh Sawhney
We were using Log4Net v1.2.13.0 with an application that targets .net framework 4 on windows server 2003, Below is the SmptAppender configuration (hiding our production values with xxxx). We were able to receive email on 'FATAL' log entry.

    <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
      <to value="xxxx" />
      <from value="xxxx" />
      <subject type="log4net.Util.PatternString" value="xxxx" />
      <smtpHost value="xxxx" />
      <username value="xxxx" />
      <password value="xxxx" />
      <authentication value="Basic" /><bufferSize value="5" /><lossy value="true" /><evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="FATAL" />
      </evaluator><layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%newline%date %-5level [%logger] %message%newline%exception%newline" />
      </layout>
    </appender>

We recently updated our application to use Log4Net v2.0.8, with the same configuration for SmptAppender . After this update, we stopped receiving emails. On enabling the internal log4Net logging, the below error was logged.

log4net: Created Appender [SmtpAppender]
log4net: Adding appender named [SmtpAppender] to logger [root].
log4net: Hierarchy Threshold []
log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Failed in DoAppend
System.TypeLoadException: Could not load type 'System.Security.Claims.ClaimsIdentity' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at log4net.Core.LoggingEvent.get_UserName()
   at log4net.Core.LoggingEvent.FixVolatileData(FixFlags flags) in c:\log4net\tags\2.0.8RC1\src\Core\LoggingEvent.cs:line 1341
   at log4net.Appender.BufferingAppenderSkeleton.Append(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\Appender\BufferingAppenderSkeleton.cs:line 483
   at log4net.Appender.AppenderSkeleton.DoAppend(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\Appender\AppenderSkeleton.cs:line 317
log4net: Shutdown called on Hierarchy [log4net-default-repository]

If we revert back to Log4Net v1.2.13.0, we start receiving emails as expected. Please advise how can we resolve the issue with version 2.0.8.


Thanks and Regards

Mohkam Singh

Reply | Threaded
Open this post in threaded view
|

Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

Dominik Psenner

On 12 Nov 2017 11:36 a.m., "Mohkam Singh Sawhney" <[hidden email]> wrote:
We were using Log4Net v1.2.13.0 with an application that targets .net framework 4 on windows server 2003, Below is the SmptAppender configuration (hiding our production values with xxxx). We were able to receive email on 'FATAL' log entry.

    <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
      <to value="xxxx" />
      <from value="xxxx" />
      <subject type="log4net.Util.PatternString" value="xxxx" />
      <smtpHost value="xxxx" />
      <username value="xxxx" />
      <password value="xxxx" />
      <authentication value="Basic" /><bufferSize value="5" /><lossy value="true" /><evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="FATAL" />
      </evaluator><layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%newline%date %-5level [%logger] %message%newline%exception%newline" />
      </layout>
    </appender>

We recently updated our application to use Log4Net v2.0.8, with the same configuration for SmptAppender . After this update, we stopped receiving emails. On enabling the internal log4Net logging, the below error was logged.

log4net: Created Appender [SmtpAppender]
log4net: Adding appender named [SmtpAppender] to logger [root].
log4net: Hierarchy Threshold []
log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Failed in DoAppend
System.TypeLoadException: Could not load type 'System.Security.Claims.ClaimsIdentity' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at log4net.Core.LoggingEvent.get_UserName()
   at log4net.Core.LoggingEvent.FixVolatileData(FixFlags flags) in c:\log4net\tags\2.0.8RC1\src\Core\LoggingEvent.cs:line 1341
   at log4net.Appender.BufferingAppenderSkeleton.Append(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\Appender\BufferingAppenderSkeleton.cs:line 483
   at log4net.Appender.AppenderSkeleton.DoAppend(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\Appender\AppenderSkeleton.cs:line 317
log4net: Shutdown called on Hierarchy [log4net-default-repository]

If we revert back to Log4Net v1.2.13.0, we start receiving emails as expected. Please advise how can we resolve the issue with version 2.0.8.


Thanks and Regards

Mohkam Singh

Reply | Threaded
Open this post in threaded view
|

Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

Mohkam Singh Sawhney
Hi Dominik,

I reviewed the accepted answer on the link that you shared.

Our application is a console application that was compiled against .net framework 4. We are using the framework 4.0 version of the log4net dll.  Windows server 2003 does not support .net framework 4.5. 

ClaimsIdentity Class was introduced in framework 4.5. (https://msdn.microsoft.com/en-us/library/system.security.claims.claimsidentity.aspx). Why is the log4net dll referencing this class?

Inline image


Thanks and Regards

Mohkam Singh


From: Dominik Psenner <[hidden email]>
To: Log4NET User <[hidden email]>; Mohkam Singh Sawhney <[hidden email]>
Sent: Monday, November 13, 2017 12:16 AM
Subject: Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003


On 12 Nov 2017 11:36 a.m., "Mohkam Singh Sawhney" <[hidden email]> wrote:
We were using Log4Net v1.2.13.0 with an application that targets .net framework 4 on windows server 2003, Below is the SmptAppender configuration (hiding our production values with xxxx). We were able to receive email on 'FATAL' log entry.

    <appender name="SmtpAppender" type="log4net.Appender. SmtpAppender">
      <to value="xxxx" />
      <from value="xxxx" />
      <subject type="log4net.Util. PatternString" value="xxxx" />
      <smtpHost value="xxxx" />
      <username value="xxxx" />
      <password value="xxxx" />
      <authentication value="Basic" /><bufferSize value="5" /><lossy value="true" /><evaluator type="log4net.Core. LevelEvaluator">
        <threshold value="FATAL" />
      </evaluator><layout type="log4net.Layout. PatternLayout">
        <conversionPattern value="%newline%date %-5level [%logger] %message%newline%exception% newline" />
      </layout>
    </appender>

We recently updated our application to use Log4Net v2.0.8, with the same configuration for SmptAppender . After this update, we stopped receiving emails. On enabling the internal log4Net logging, the below error was logged.

log4net: Created Appender [SmtpAppender]
log4net: Adding appender named [SmtpAppender] to logger [root].
log4net: Hierarchy Threshold []
log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Failed in DoAppend
System.TypeLoadException: Could not load type 'System.Security.Claims. ClaimsIdentity' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken= b77a5c561934e089'.
   at log4net.Core.LoggingEvent.get_ UserName()
   at log4net.Core.LoggingEvent. FixVolatileData(FixFlags flags) in c:\log4net\tags\2.0.8RC1\src\ Core\LoggingEvent.cs:line 1341
   at log4net.Appender. BufferingAppenderSkeleton. Append(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\ Appender\ BufferingAppenderSkeleton.cs: line 483
   at log4net.Appender. AppenderSkeleton.DoAppend( LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\ Appender\AppenderSkeleton.cs: line 317
log4net: Shutdown called on Hierarchy [log4net-default-repository]

If we revert back to Log4Net v1.2.13.0, we start receiving emails as expected. Please advise how can we resolve the issue with version 2.0.8.


Thanks and Regards

Mohkam Singh



Reply | Threaded
Open this post in threaded view
|

Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

Dominik Psenner
log4net should not even compile if it referenced classes that do not exist in a targetted framework. Note that this might be related to https://issues.apache.org/jira/browse/LOG4NET-548 too. This could be a symptom of the fact that net 4.5 is a in place replacement of net 4.0. You should be able to confirm this if you tried to compile log4net on a machine that has only net 4.0 installed. Unfortunately i have no possibility to evaluate this because I have no operating system to evaluate this on.

On 13 Nov 2017 5:58 p.m., "Mohkam Singh Sawhney" <[hidden email]> wrote:
Hi Dominik,

I reviewed the accepted answer on the link that you shared.

Our application is a console application that was compiled against .net framework 4. We are using the framework 4.0 version of the log4net dll.  Windows server 2003 does not support .net framework 4.5. 

ClaimsIdentity Class was introduced in framework 4.5. (https://msdn.microsoft.com/en-us/library/system.security.claims.claimsidentity.aspx). Why is the log4net dll referencing this class?

Inline image


Thanks and Regards

Mohkam Singh


From: Dominik Psenner <[hidden email]>
To: Log4NET User <[hidden email]>; Mohkam Singh Sawhney <[hidden email]>
Sent: Monday, November 13, 2017 12:16 AM
Subject: Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003


On 12 Nov 2017 11:36 a.m., "Mohkam Singh Sawhney" <[hidden email]> wrote:
We were using Log4Net v1.2.13.0 with an application that targets .net framework 4 on windows server 2003, Below is the SmptAppender configuration (hiding our production values with xxxx). We were able to receive email on 'FATAL' log entry.

    <appender name="SmtpAppender" type="log4net.Appender. SmtpAppender">
      <to value="xxxx" />
      <from value="xxxx" />
      <subject type="log4net.Util. PatternString" value="xxxx" />
      <smtpHost value="xxxx" />
      <username value="xxxx" />
      <password value="xxxx" />
      <authentication value="Basic" /><bufferSize value="5" /><lossy value="true" /><evaluator type="log4net.Core. LevelEvaluator">
        <threshold value="FATAL" />
      </evaluator><layout type="log4net.Layout. PatternLayout">
        <conversionPattern value="%newline%date %-5level [%logger] %message%newline%exception% newline" />
      </layout>
    </appender>

We recently updated our application to use Log4Net v2.0.8, with the same configuration for SmptAppender . After this update, we stopped receiving emails. On enabling the internal log4Net logging, the below error was logged.

log4net: Created Appender [SmtpAppender]
log4net: Adding appender named [SmtpAppender] to logger [root].
log4net: Hierarchy Threshold []
log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Failed in DoAppend
System.TypeLoadException: Could not load type 'System.Security.Claims. ClaimsIdentity' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken= b77a5c561934e089'.
   at log4net.Core.LoggingEvent.get_ UserName()
   at log4net.Core.LoggingEvent. FixVolatileData(FixFlags flags) in c:\log4net\tags\2.0.8RC1\src\ Core\LoggingEvent.cs:line 1341
   at log4net.Appender. BufferingAppenderSkeleton. Append(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\ Appender\ BufferingAppenderSkeleton.cs: line 483
   at log4net.Appender. AppenderSkeleton.DoAppend( LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\ Appender\AppenderSkeleton.cs: line 317
log4net: Shutdown called on Hierarchy [log4net-default-repository]

If we revert back to Log4Net v1.2.13.0, we start receiving emails as expected. Please advise how can we resolve the issue with version 2.0.8.


Thanks and Regards

Mohkam Singh




Reply | Threaded
Open this post in threaded view
|

Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

Mohkam Singh Sawhney
Unfortunately even I will not be able to confirm this, as I am working on a machine which has .net 4.5.




From: Dominik Psenner <[hidden email]>
To: Mohkam Singh Sawhney <[hidden email]>
Cc: Log4NET User <[hidden email]>
Sent: Tuesday, November 14, 2017 1:24 PM
Subject: Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003

log4net should not even compile if it referenced classes that do not exist in a targetted framework. Note that this might be related to https://issues.apache.org/jira/browse/LOG4NET-548 too. This could be a symptom of the fact that net 4.5 is a in place replacement of net 4.0. You should be able to confirm this if you tried to compile log4net on a machine that has only net 4.0 installed. Unfortunately i have no possibility to evaluate this because I have no operating system to evaluate this on.

On 13 Nov 2017 5:58 p.m., "Mohkam Singh Sawhney" <[hidden email]> wrote:
Hi Dominik,

I reviewed the accepted answer on the link that you shared.

Our application is a console application that was compiled against .net framework 4. We are using the framework 4.0 version of the log4net dll.  Windows server 2003 does not support .net framework 4.5. 

ClaimsIdentity Class was introduced in framework 4.5. (https://msdn.microsoft.com/ en-us/library/system.security. claims.claimsidentity.aspx). Why is the log4net dll referencing this class?

Inline image


Thanks and Regards

Mohkam Singh


From: Dominik Psenner <[hidden email]>
To: Log4NET User <[hidden email]>; Mohkam Singh Sawhney <[hidden email]>
Sent: Monday, November 13, 2017 12:16 AM
Subject: Re: Log4Net v2.0.8 - SMTP appender not relaying emails on Windows Server 2003


On 12 Nov 2017 11:36 a.m., "Mohkam Singh Sawhney" <[hidden email]> wrote:
We were using Log4Net v1.2.13.0 with an application that targets .net framework 4 on windows server 2003, Below is the SmptAppender configuration (hiding our production values with xxxx). We were able to receive email on 'FATAL' log entry.

    <appender name="SmtpAppender" type="log4net.Appender. SmtpAppender">
      <to value="xxxx" />
      <from value="xxxx" />
      <subject type="log4net.Util. PatternString" value="xxxx" />
      <smtpHost value="xxxx" />
      <username value="xxxx" />
      <password value="xxxx" />
      <authentication value="Basic" /><bufferSize value="5" /><lossy value="true" /><evaluator type="log4net.Core. LevelEvaluator">
        <threshold value="FATAL" />
      </evaluator><layout type="log4net.Layout. PatternLayout">
        <conversionPattern value="%newline%date %-5level [%logger] %message%newline%exception% newline" />
      </layout>
    </appender>

We recently updated our application to use Log4Net v2.0.8, with the same configuration for SmptAppender . After this update, we stopped receiving emails. On enabling the internal log4Net logging, the below error was logged.

log4net: Created Appender [SmtpAppender]
log4net: Adding appender named [SmtpAppender] to logger [root].
log4net: Hierarchy Threshold []
log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Failed in DoAppend
System.TypeLoadException: Could not load type 'System.Security.Claims. ClaimsIdentity' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken= b77a5c561934e089'.
   at log4net.Core.LoggingEvent.get_ UserName()
   at log4net.Core.LoggingEvent. FixVolatileData(FixFlags flags) in c:\log4net\tags\2.0.8RC1\src\ Core\LoggingEvent.cs:line 1341
   at log4net.Appender. BufferingAppenderSkeleton. Append(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\ Appender\ BufferingAppenderSkeleton.cs: line 483
   at log4net.Appender. AppenderSkeleton.DoAppend( LoggingEvent loggingEvent) in c:\log4net\tags\2.0.8RC1\src\ Appender\AppenderSkeleton.cs: line 317
log4net: Shutdown called on Hierarchy [log4net-default-repository]

If we revert back to Log4Net v1.2.13.0, we start receiving emails as expected. Please advise how can we resolve the issue with version 2.0.8.


Thanks and Regards

Mohkam Singh