Just to warn you - I'd be careful about this as I've done it and
received thousands of e-mails in my inbox from it. I've since found an
RSS Appender more helpful - but that requires you to check your RSS
Reader frequently.

Matt

On 1/14/08, Peter Schneider-Manzell <[EMAIL PROTECTED]> wrote:
> If you want to receive an email every time an error occurs,
> i recommend to use the smtp appender of log4j:
>
> <appender name="mail"
> class="org.apache.log4j.net.SMTPAppender">
>         <param name="SMTPHost" value=" smtp.yourhost.com" />
>         <param name="From" value="[EMAIL PROTECTED]" />
>         <param name="To" value=" [EMAIL PROTECTED]" />
>         <param name="Subject" value="[Your App] Exception" />
>         <param name="BufferSize" value="0" />
>         <param name="threshold" value="WARN" />
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L
> - %m%n" />
>         </layout>
>     </appender>
>
> Bye,
>
> Peter
>
> 2008/1/11, Ding, Qin <[EMAIL PROTECTED]>:
> >
> >
> >
> >
> > Mike: thank you. I'll take a look at this document.  By the way, is it a
> way that I can send an email when an error causes Yikes to be displayed?
> Thanks
> >
> >
> >
> > ________________________________
>
> >
> > From: Michael Horwitz [mailto:[EMAIL PROTECTED]
> > Sent: Friday, January 11, 2008 9:25 AM
> >
> > To: users@appfuse.dev.java.net
> > Subject: Re: [appfuse-user] Yikes Error Page
> >
> >
> >
> >
> >
> > You may want to have a look at the ACEGI tag libraries to help here:
> >
> >
> >
> http://www.acegisecurity.org/guide/springsecurity.html#taglib
> >
> >
> >
> >
> >
> > Mike
> >
> >
> >
> > On 1/11/08, Ding, Qin <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > I modified error.jsp.  I have a requirement that admin can see the error
> message from the error stack on the page but not regular user, who only see
> the simple message.  Therefore, I need to have the access to the user
> object.  This is what I did:
> >
> >
> >
> > <%
> >
> >                 User user = null;
> >
> >
> >
> >                 if (SecurityContextHolder.getContext() !=
> null) {
> >
> >                   SecurityContext sc = (SecurityContext)
> SecurityContextHolder.getContext();
> >
> >                   Authentication auth = sc.getAuthentication();
> >
> >                   if (auth != null) {
> >
> >                     user = (User) auth.getPrincipal();
> >
> >                   }
> >
> >                 }
> >
> >
> >
> >                 if (user != null && user.isAdmin()){ %>
> >
> >  ------
> >
> >
> >
> > <% } %>
> >
> > %>
> >
> >
> >
> >
> >
> > The problem is Authentication retrieved from securityContext is always
> null. Is Authentication object invalidated due to the error?
> >
> > How can I still get the access to the User object at this point?  Thank
> you.
> >
> >
> >
> > QD
> >
> >
> > ________________________________
>
> >
> > From: Michael Horwitz [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, January 09, 2008 11:17 AM
> > To: users@appfuse.dev.java.net
> > Subject: Re: [appfuse-user] Yikes Error Page
> >
> >
> >
> >
> >
> > Assuming you are using Struts with AppFuse 2.0.1 the page displayed on
> error is error.jsp. You can change the contents to be anything you like.
> >
> >
> >
> >
> >
> >
> > Mike
> >
> >
> >
> > On 1/9/08, Ding, Qin < [EMAIL PROTECTED]> wrote:
> >
> > How can I replace "YIKES" error page with a user friendly message while
> > logging "YIKES" error stack?  Or after logging the error, present the
> > user with friendly page.  Thanks
> >
> > QD
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to