E-mail notification when errors occur
- NC Software
- AbleCommerce Partner
- Posts: 4620
- Joined: Mon Sep 13, 2004 6:06 pm
- Contact:
E-mail notification when errors occur
It would have really helped me, the System Admin (whatever the role is called) to get an e-mail notification of error log entries. If I had been getting notified by e-mail, SMS, whatever, that an error occurred, I would have been on top of the e-mail template system as it generated errors when trying to parse the nVelocity stuff that got pooched by the FCK'ing editor. I suggest add an option to e-mail the admin (or enter an address for error notifications). I just now noticed there were errors in the error log and they indicated the e-mail templates were pooched but I wasn't aware of the errors.
Neal Culiner
NC Software, Inc.
NC Software, Inc.
Re: E-mail notification when errors occur
Read following thread
viewtopic.php?f=42&t=11796
viewtopic.php?f=42&t=11796
Re: E-mail notification when errors occur
That NEEDS to go into 7.0.5
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
Re: E-mail notification when errors occur
Thanks Mazhar,
I have added that to my code snippet library.
I have added that to my code snippet library.
Able Customer Since 1999 Currently Running on GOLD R12 SR1 and PCI Certified.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: E-mail notification when errors occur
Yes, that is great. I've had code in a global.asax file and code that runs with Elmah.dll stuff, but neither of them works well consistently.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: E-mail notification when errors occur
Another way to approach this would be to alter the log4net.config file. I should construct a tutorial on that.
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: E-mail notification when errors occur
As I mentioned in my previous post, we use log4net as our logging facility. This is a fairly common logging system that is used by a wide variety of applications. It is also highly configurable.
All of the settings for log4net reside in App_Data\log4net.config. NOTE: Any change to log4net.config will require a manual restart of the application to take effect. The quick hack way of doing this is to open the web.config in the root of your website, go to the end of the file, press enter, and save. The file change will trigger an automatic restart of the app and reload the log4net.config file.
The log4net library supports a huge range of "appenders"... It is the appender that decides whether to log your error to file, to database, to the console, to the windows event log, to email, etc. You can configure multiple appenders.
One benefit to doing this for the email vs a global.asax change is that you can also get context information... log4net will send you X number of messages prior to the exception. It may or may not be helpful. I am going to post a sample log4net.config file that has been modified to send email:
In the SmtpAppender definition, buffer size indicates how many of the prior log messages will be included. Threshold indicates what level will register the email. I have it set to WARN. You could also set it to ERROR to only see more critical problems.
All of the settings for log4net reside in App_Data\log4net.config. NOTE: Any change to log4net.config will require a manual restart of the application to take effect. The quick hack way of doing this is to open the web.config in the root of your website, go to the end of the file, press enter, and save. The file change will trigger an automatic restart of the app and reload the log4net.config file.
The log4net library supports a huge range of "appenders"... It is the appender that decides whether to log your error to file, to database, to the console, to the windows event log, to email, etc. You can configure multiple appenders.
One benefit to doing this for the email vs a global.asax change is that you can also get context information... log4net will send you X number of messages prior to the exception. It may or may not be helpful. I am going to post a sample log4net.config file that has been modified to send email:
Code: Select all
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="App_Data\\Logs\\app.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
</layout>
</appender>
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<to value="to@domain" />
<from value="from@domain" />
<subject value="Subject of error message" />
<smtpHost value="smtp.server.address" />
<bufferSize value="10" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
</layout>
</appender>
<root>
<level value="All" />
<appender-ref ref="RollingLogFileAppender" />
<appender-ref ref="SmtpAppender" />
</root>
</log4net>
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: E-mail notification when errors occur
I have moved this thread to the main forum as others may be interested to see how to make this configuration change.
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.