in the catch do a log.error("An error message", caughtException)....

..... and in your log4j config, put smtp appender for log.error. That way you get an instant email and can fix it even if customer never calls. If they do call you can tell them you are working on it and ask them some questions about what they were doing when the error happened. Do sth like this in log4j config ....


# log4j appender and formatting
log4j.rootLogger=A2, myMail
log4j.loggerFactory=er.extensions.ERXLogger$Factory

# A1 is a ConsoleAppender
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=er.extensions.ERXPatternLayout
#log4j.appender.A1.layout.ConversionPattern=%-5p %d{HH:mm:ss} (%-20c:% L) %x -%m%n log4j.appender.A1.layout.ConversionPattern=%r %-5p [%t] (%C{3}, %M, % L) - %n%m%n%n

# A2 is a DailyRollingFileAppender
log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=/var/log/webobjects_apps/my.woa.log
log4j.appender.A2.datePattern='.'yyyy-MM-dd
log4j.appender.A2.append=true
log4j.appender.A2.layout=er.extensions.ERXPatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} [%t] (%c: %L) - %m%n

# myMail is the SMTPAppender
log4j.appender.myMail=org.apache.log4j.net.SMTPAppender
log4j.appender.myMail.Threshold=ERROR
log4j.appender.myMail.BufferSize=10
[EMAIL PROTECTED]
[EMAIL PROTECTED],[EMAIL PROTECTED]
log4j.appender.myMail.SMTPHost=smtp.mydomain.com
log4j.appender.myMail.Subject=Log4J Error Message (from myApp.woa)
log4j.appender.myMail.layout=er.extensions.ERXPatternLayout
log4j.appender.myMail.layout.ConversionPattern=%r %-5p %d{ISO8601} [% t] %n%n (%C, %M, %F:%L) - %n%n%m%n





On Sep 8, 2007, at 9:42 AM, James Cicenia wrote:

And then...

I leave out try catches because if I get a null exception in the try I have no idea what line it is and won't get a call form the customer. So, I am now in the habit of rarely using them unless obviously required. I actually like.. .bam! null exception... line XXXX, it really helps to tighten up applications fast as the user will notice it right away.

james

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to