SmtpAppender not working on 3rd party hosting provider
I'm trying to figure out a situation where the SmtpAppender in my ASP.NET 3.5 application works properly on my development machine, but not on GoDaddy shared hosting. This might be easier, except that I can't see the output when log4net.Internal.Debug = true at GoDaddy, because we have no access to, and cannot add a listener for the System.Diagnostics output. Some points: - This works on my development machine with the same log4net.config. However, in my web.config, of course, the SMTP server information is different for development and production. - Other logs from my RollingFileAppender appear properly, so log4net is working. - I know that I can send email, because a test page coded as follows in production works: { string sFrom = [EMAIL PROTECTED]; string sTo = [EMAIL PROTECTED]; string sSubject = test email to debug log4net on GoDaddy; string sBody = Why are log4net email notifications not working on GoDaddy?; MailMessage message = new MailMessage(sFrom, sTo, sSubject, sBody); SmtpClient client = new SmtpClient(); client.Send(message); } - My appender in log4net.config looks like this: !-- sends an SMTP email (application log) -- appender name=ApplicationSmtpAppender type=log4net.Appender.SmtpAppender from value=[EMAIL PROTECTED] / to value=[EMAIL PROTECTED] / subject value=Application log / bufferSize value=50 / lossy value=true / evaluator type=log4net.Core.LevelEvaluator threshold value=WARN/ /evaluator layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{CurrentUser}] - %message%newline / /layout /appender Does anyone either know what this could be, or have another suggestion for debugging it short of recompiling log4net with custom instrumenting code that writes to a file? thanks, Pete
RE: SmtpAppender not working on 3rd party hosting provider
Have you tried specifiying the smtp server to use in your log4net config file... smtpHost value=mail.somedomain.com / -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 9:05 AM To: log4net-user@logging.apache.org Subject: SmtpAppender not working on 3rd party hosting provider I'm trying to figure out a situation where the SmtpAppender in my ASP.NET 3.5 application works properly on my development machine, but not on GoDaddy shared hosting. This might be easier, except that I can't see the output when log4net.Internal.Debug = true at GoDaddy, because we have no access to, and cannot add a listener for the System.Diagnostics output. Some points: - This works on my development machine with the same log4net.config. However, in my web.config, of course, the SMTP server information is different for development and production. - Other logs from my RollingFileAppender appear properly, so log4net is working. - I know that I can send email, because a test page coded as follows in production works: { string sFrom = [EMAIL PROTECTED]; string sTo = [EMAIL PROTECTED]; string sSubject = test email to debug log4net on GoDaddy; string sBody = Why are log4net email notifications not working on GoDaddy?; MailMessage message = new MailMessage(sFrom, sTo, sSubject, sBody); SmtpClient client = new SmtpClient(); client.Send(message); } - My appender in log4net.config looks like this: !-- sends an SMTP email (application log) -- appender name=ApplicationSmtpAppender type=log4net.Appender.SmtpAppender from value=[EMAIL PROTECTED] / to value=[EMAIL PROTECTED] / subject value=Application log / bufferSize value=50 / lossy value=true / evaluator type=log4net.Core.LevelEvaluator threshold value=WARN/ /evaluator layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{CurrentUser}] - %message%newline / /layout /appender Does anyone either know what this could be, or have another suggestion for debugging it short of recompiling log4net with custom instrumenting code that writes to a file? thanks, Pete
RE: SmtpAppender not working on 3rd party hosting provider
Hi Dean, Yes, even if smtpHost is specified in log4net.config, it still doesn't send. Looking at SmtpAppender.cs in log4net, if I set smtpHost, it's the same code path except that the Host property on SmtpClient is explicitly set. Knowing that my test page works without setting the Host property explicitly, I can tell that SmtpClient is picking up the right host from the mailSettings section in my web.config file anyway: mailSettings smtp network host=relay-hosting.secureserver.net port=25/ /smtp /mailSettings thanks, Pete -Original Message- From: Dean Fiala [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 3:54 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Have you tried specifiying the smtp server to use in your log4net config file... smtpHost value=mail.somedomain.com / -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 9:05 AM To: log4net-user@logging.apache.org Subject: SmtpAppender not working on 3rd party hosting provider I'm trying to figure out a situation where the SmtpAppender in my ASP.NET 3.5 application works properly on my development machine, but not on GoDaddy shared hosting. This might be easier, except that I can't see the output when log4net.Internal.Debug = true at GoDaddy, because we have no access to, and cannot add a listener for the System.Diagnostics output. Some points: - This works on my development machine with the same log4net.config. However, in my web.config, of course, the SMTP server information is different for development and production. - Other logs from my RollingFileAppender appear properly, so log4net is working. - I know that I can send email, because a test page coded as follows in production works: { string sFrom = [EMAIL PROTECTED]; string sTo = [EMAIL PROTECTED]; string sSubject = test email to debug log4net on GoDaddy; string sBody = Why are log4net email notifications not working on GoDaddy?; MailMessage message = new MailMessage(sFrom, sTo, sSubject, sBody); SmtpClient client = new SmtpClient(); client.Send(message); } - My appender in log4net.config looks like this: !-- sends an SMTP email (application log) -- appender name=ApplicationSmtpAppender type=log4net.Appender.SmtpAppender from value=[EMAIL PROTECTED] / to value=[EMAIL PROTECTED] / subject value=Application log / bufferSize value=50 / lossy value=true / evaluator type=log4net.Core.LevelEvaluator threshold value=WARN/ /evaluator layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{CurrentUser}] - %message%newline / /layout /appender Does anyone either know what this could be, or have another suggestion for debugging it short of recompiling log4net with custom instrumenting code that writes to a file? thanks, Pete
RE: SmtpAppender not working on 3rd party hosting provider
It's narrowed down a bit. If I set: trust level=Medium/ on my development machine, the SmtpAppender fails silently, while my RollingFileAppenders still work. Incidently, I've got my log4net.config file in a separate file, rather than in my web.config file. This appears to be working OK, but as I've seen a post about log4net configuration and medium trust here: http://blogs.advantaje.com/blog/kevin/Net/2006/06/29/log4Net-and-ASP-Net-Med ium-Trust.html it makes me suspicious. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:09 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Hi Dean, Yes, even if smtpHost is specified in log4net.config, it still doesn't send. Looking at SmtpAppender.cs in log4net, if I set smtpHost, it's the same code path except that the Host property on SmtpClient is explicitly set. Knowing that my test page works without setting the Host property explicitly, I can tell that SmtpClient is picking up the right host from the mailSettings section in my web.config file anyway: mailSettings smtp network host=relay-hosting.secureserver.net port=25/ /smtp /mailSettings thanks, Pete -Original Message- From: Dean Fiala [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 3:54 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Have you tried specifiying the smtp server to use in your log4net config file... smtpHost value=mail.somedomain.com / -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 9:05 AM To: log4net-user@logging.apache.org Subject: SmtpAppender not working on 3rd party hosting provider I'm trying to figure out a situation where the SmtpAppender in my ASP.NET 3.5 application works properly on my development machine, but not on GoDaddy shared hosting. This might be easier, except that I can't see the output when log4net.Internal.Debug = true at GoDaddy, because we have no access to, and cannot add a listener for the System.Diagnostics output. Some points: - This works on my development machine with the same log4net.config. However, in my web.config, of course, the SMTP server information is different for development and production. - Other logs from my RollingFileAppender appear properly, so log4net is working. - I know that I can send email, because a test page coded as follows in production works: { string sFrom = [EMAIL PROTECTED]; string sTo = [EMAIL PROTECTED]; string sSubject = test email to debug log4net on GoDaddy; string sBody = Why are log4net email notifications not working on GoDaddy?; MailMessage message = new MailMessage(sFrom, sTo, sSubject, sBody); SmtpClient client = new SmtpClient(); client.Send(message); } - My appender in log4net.config looks like this: !-- sends an SMTP email (application log) -- appender name=ApplicationSmtpAppender type=log4net.Appender.SmtpAppender from value=[EMAIL PROTECTED] / to value=[EMAIL PROTECTED] / subject value=Application log / bufferSize value=50 / lossy value=true / evaluator type=log4net.Core.LevelEvaluator threshold value=WARN/ /evaluator layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{CurrentUser}] - %message%newline / /layout /appender Does anyone either know what this could be, or have another suggestion for debugging it short of recompiling log4net with custom instrumenting code that writes to a file? thanks, Pete
RE: SmtpAppender not working on 3rd party hosting provider
I found the SecurityException that's causing the SmtpAppender to fail. The stack trace is below. (I wasn't seeing it before as I'd had system.diagnostics redirected to a file, which was also causing a SecurityException that I didn't see.) Anyone know how to solve this one? Things I've tried include: - reading configuration from web.config instead of my separate log4net.config - removing my GlobalContext.Properties settings and use of context properties, thinking that the LinkDemand was happening when log4net was calling my class to get my [%property{CurrentUser}], but apparently it's not - setting [assembly: AllowPartiallyTrustedCallers] on my UserProvider class, which is stuffed into GlobalContext.Properties From the stack, the LinkDemand appears to occur in log4net.Util.LogicalThreadContextProperties.GetProperties(), which likely happens when CallContext.GetData is called(?), but I'm not sure how to get around this. -- Begin Stack Trace -- log4net:ERROR [SmtpAppender] Failed in DoAppend System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action) at log4net.Util.LogicalThreadContextProperties.GetProperties(Boolean create) at log4net.Core.LoggingEvent.CreateCompositeProperties() at log4net.Core.LoggingEvent.CacheProperties() at log4net.Core.LoggingEvent.FixVolatileData(FixFlags flags) at log4net.Appender.BufferingAppenderSkeleton.Append(LoggingEvent loggingEvent) at log4net.Appender.AppenderSkeleton.DoAppend(LoggingEvent loggingEvent) The action that failed was: LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone of the assembly that failed was: MyComputer -- End Stack Trace -- If there are any suggestions, let me know. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:39 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider It's narrowed down a bit. If I set: trust level=Medium/ on my development machine, the SmtpAppender fails silently, while my RollingFileAppenders still work. Incidently, I've got my log4net.config file in a separate file, rather than in my web.config file. This appears to be working OK, but as I've seen a post about log4net configuration and medium trust here: http://blogs.advantaje.com/blog/kevin/Net/2006/06/29/log4Net-and-ASP-Net-Med ium-Trust.html it makes me suspicious. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:09 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Hi Dean, Yes, even if smtpHost is specified in log4net.config, it still doesn't send. Looking at SmtpAppender.cs in log4net, if I set smtpHost, it's the same code path except that the Host property on SmtpClient is explicitly set. Knowing that my test page works without setting the Host property explicitly, I can tell that SmtpClient is picking up the right host from the mailSettings section in my web.config file anyway: mailSettings smtp network host=relay-hosting.secureserver.net port=25/ /smtp /mailSettings thanks, Pete -Original Message- From: Dean Fiala [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 3:54 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Have you tried specifiying the smtp server to use in your log4net config file... smtpHost value=mail.somedomain.com / -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 9:05 AM To: log4net-user@logging.apache.org Subject: SmtpAppender not working on 3rd party hosting provider I'm trying to figure out a situation where the SmtpAppender in my ASP.NET 3.5 application works properly on my development machine, but not on GoDaddy shared hosting. This might be easier, except that I can't see the output when
RE: SmtpAppender not working on 3rd party hosting provider
Apologies for the list traffic, but this appears to have been fixed by Nicko back in July of 2006: http://issues.apache.org/jira/browse/LOG4NET-79?page=com.atlassian.jira.plug in.system.issuetabpanels:all-tabpanel http://mail-archives.apache.org/mod_mbox/logging-log4net-user/200607.mbox/%3 [EMAIL PROTECTED] and targeted for version 1.2.11, which never came out. I guess I'll have to apply his patch by hand or not use the SmtpAppender under medium trust. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 6:08 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider I found the SecurityException that's causing the SmtpAppender to fail. The stack trace is below. (I wasn't seeing it before as I'd had system.diagnostics redirected to a file, which was also causing a SecurityException that I didn't see.) Anyone know how to solve this one? Things I've tried include: - reading configuration from web.config instead of my separate log4net.config - removing my GlobalContext.Properties settings and use of context properties, thinking that the LinkDemand was happening when log4net was calling my class to get my [%property{CurrentUser}], but apparently it's not - setting [assembly: AllowPartiallyTrustedCallers] on my UserProvider class, which is stuffed into GlobalContext.Properties From the stack, the LinkDemand appears to occur in log4net.Util.LogicalThreadContextProperties.GetProperties(), which likely happens when CallContext.GetData is called(?), but I'm not sure how to get around this. -- Begin Stack Trace -- log4net:ERROR [SmtpAppender] Failed in DoAppend System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action) at log4net.Util.LogicalThreadContextProperties.GetProperties(Boolean create) at log4net.Core.LoggingEvent.CreateCompositeProperties() at log4net.Core.LoggingEvent.CacheProperties() at log4net.Core.LoggingEvent.FixVolatileData(FixFlags flags) at log4net.Appender.BufferingAppenderSkeleton.Append(LoggingEvent loggingEvent) at log4net.Appender.AppenderSkeleton.DoAppend(LoggingEvent loggingEvent) The action that failed was: LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone of the assembly that failed was: MyComputer -- End Stack Trace -- If there are any suggestions, let me know. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:39 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider It's narrowed down a bit. If I set: trust level=Medium/ on my development machine, the SmtpAppender fails silently, while my RollingFileAppenders still work. Incidently, I've got my log4net.config file in a separate file, rather than in my web.config file. This appears to be working OK, but as I've seen a post about log4net configuration and medium trust here: http://blogs.advantaje.com/blog/kevin/Net/2006/06/29/log4Net-and-ASP-Net-Med ium-Trust.html it makes me suspicious. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:09 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Hi Dean, Yes, even if smtpHost is specified in log4net.config, it still doesn't send. Looking at SmtpAppender.cs in log4net, if I set smtpHost, it's the same code path except that the Host property on SmtpClient is explicitly set. Knowing that my test page works without setting the Host property explicitly, I can tell that SmtpClient is picking up the right host from the mailSettings section in my web.config file anyway: mailSettings smtp network host=relay-hosting.secureserver.net port=25/ /smtp /mailSettings thanks, Pete -Original Message- From: Dean Fiala [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30
Re: SmtpAppender not working on 3rd party hosting provider
JIRA is down right now but couldn't you extend SmtpAppender in your own assembly and override the method(s) needed then use the SmtpAppender in your new assembly? I use GoDaddy.com too. I remember SmtpAppender working fine under ASP.Net 1.0. I think it stopped working when I upgraded to ASP.Net 2.0. Thanks for summarizing your research for the list. - Original Message From: Pete Heist [EMAIL PROTECTED] To: Log4NET User log4net-user@logging.apache.org Sent: Wednesday, April 30, 2008 12:59:59 PM Subject: RE: SmtpAppender not working on 3rd party hosting provider Apologies for the list traffic, but this appears to have been fixed by Nicko back in July of 2006: http://issues.apache.org/jira/browse/LOG4NET-79?page=com.atlassian.jira.plug in.system.issuetabpanels:all-tabpanel http://mail-archives.apache.org/mod_mbox/logging-log4net-user/200607.mbox/%3 [EMAIL PROTECTED] and targeted for version 1.2.11, which never came out. I guess I'll have to apply his patch by hand or not use the SmtpAppender under medium trust. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 6:08 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider I found the SecurityException that's causing the SmtpAppender to fail. The stack trace is below. (I wasn't seeing it before as I'd had system.diagnostics redirected to a file, which was also causing a SecurityException that I didn't see.) Anyone know how to solve this one? Things I've tried include: - reading configuration from web.config instead of my separate log4net.config - removing my GlobalContext.Properties settings and use of context properties, thinking that the LinkDemand was happening when log4net was calling my class to get my [%property{CurrentUser}], but apparently it's not - setting [assembly: AllowPartiallyTrustedCallers] on my UserProvider class, which is stuffed into GlobalContext.Properties From the stack, the LinkDemand appears to occur in log4net.Util.LogicalThreadContextProperties.GetProperties(), which likely happens when CallContext.GetData is called(?), but I'm not sure how to get around this. -- Begin Stack Trace -- log4net:ERROR [SmtpAppender] Failed in DoAppend System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action) at log4net.Util.LogicalThreadContextProperties.GetProperties(Boolean create) at log4net.Core.LoggingEvent.CreateCompositeProperties() at log4net.Core.LoggingEvent.CacheProperties() at log4net.Core.LoggingEvent.FixVolatileData(FixFlags flags) at log4net.Appender.BufferingAppenderSkeleton.Append(LoggingEvent loggingEvent) at log4net.Appender.AppenderSkeleton.DoAppend(LoggingEvent loggingEvent) The action that failed was: LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone of the assembly that failed was: MyComputer -- End Stack Trace -- If there are any suggestions, let me know. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:39 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider It's narrowed down a bit. If I set: trust level=Medium/ on my development machine, the SmtpAppender fails silently, while my RollingFileAppenders still work. Incidently, I've got my log4net.config file in a separate file, rather than in my web.config file. This appears to be working OK, but as I've seen a post about log4net configuration and medium trust here: http://blogs.advantaje.com/blog/kevin/Net/2006/06/29/log4Net-and-ASP-Net-Med ium-Trust.html it makes me suspicious. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:09 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider Hi Dean, Yes, even if smtpHost is specified
RE: SmtpAppender not working on 3rd party hosting provider
Hi Ron- Thanks for the tip...that's true, I could have extended SmtpAppender, which may have been easier. I may end up doing that in the end, especially if I suspect my build is bad. As it turns out, I couldn't get the patch made in LOG4NET-79 working for me (don't think it would work for anyone), so that's why I instead changed LoggingEvent. The problem seems to be that the SecurityException is thrown before the LogicalThreadContextProperties.GetProperties() method is even called, so there's no opportunity to catch it in that method. What I ended up doing was: - In LoggingEvent.CreateCompositeProperties(), comment out lines 1308 - 1312 that call and use the results from LogicalThreadContext.Properties.GetProperties(false). - Build log4net in Visual Studio Express 2008. I had to convert project to 2008, set target framework to .NET 2.0 and define NET_2_0. Suspiciously, my dll is 236K, which is different from the binary distribution's dll of 264K, but it still seems to work so far. As a side effect, not only is SmtpAppender now working but my use of properties in the GlobalContext is now working as well. The caveat is that, since it's commented out, I can't use LogicalThreadContext properties, but I wasn't using them anyway. Perhaps a better fix for the final log4net dll would be to catch the SecurityException in LoggingEvent (assuming you can), disable ThreadContext properties so exceptions don't keep getting thrown and log a message to LogLog. thanks, Pete -Original Message- From: Ron Grabowski [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 10:49 PM To: Log4NET User Subject: Re: SmtpAppender not working on 3rd party hosting provider JIRA is down right now but couldn't you extend SmtpAppender in your own assembly and override the method(s) needed then use the SmtpAppender in your new assembly? I use GoDaddy.com too. I remember SmtpAppender working fine under ASP.Net 1.0. I think it stopped working when I upgraded to ASP.Net 2.0. Thanks for summarizing your research for the list. - Original Message From: Pete Heist [EMAIL PROTECTED] To: Log4NET User log4net-user@logging.apache.org Sent: Wednesday, April 30, 2008 12:59:59 PM Subject: RE: SmtpAppender not working on 3rd party hosting provider Apologies for the list traffic, but this appears to have been fixed by Nicko back in July of 2006: http://issues.apache.org/jira/browse/LOG4NET-79?page=com.atlassian.jira.plug in.system.issuetabpanels:all-tabpanel http://mail-archives.apache.org/mod_mbox/logging-log4net-user/200607.mbox/%3 [EMAIL PROTECTED] and targeted for version 1.2.11, which never came out. I guess I'll have to apply his patch by hand or not use the SmtpAppender under medium trust. thanks, Pete -Original Message- From: Pete Heist [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 6:08 PM To: 'Log4NET User' Subject: RE: SmtpAppender not working on 3rd party hosting provider I found the SecurityException that's causing the SmtpAppender to fail. The stack trace is below. (I wasn't seeing it before as I'd had system.diagnostics redirected to a file, which was also causing a SecurityException that I didn't see.) Anyone know how to solve this one? Things I've tried include: - reading configuration from web.config instead of my separate log4net.config - removing my GlobalContext.Properties settings and use of context properties, thinking that the LinkDemand was happening when log4net was calling my class to get my [%property{CurrentUser}], but apparently it's not - setting [assembly: AllowPartiallyTrustedCallers] on my UserProvider class, which is stuffed into GlobalContext.Properties From the stack, the LinkDemand appears to occur in log4net.Util.LogicalThreadContextProperties.GetProperties(), which likely happens when CallContext.GetData is called(?), but I'm not sure how to get around this. -- Begin Stack Trace -- log4net:ERROR [SmtpAppender] Failed in DoAppend System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands