--
You received this message because you are subscribed to the Google Groups "ELMAH" group.
To post to this group, send email to el...@googlegroups.com.
To unsubscribe from this group, send email to elmah+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/elmah?hl=en.
On Jan 12, 7:23 am, Atif Aziz <aziza...@gmail.com> wrote:
> Hi Nick,
>
> Technically, it is possible to get ELMAH to log exception in a console
> application but obviously the HTTP modules and handlers won't do anything
> automagically. There is nothing preventing you from creating an instance of,
> for example, SqlErrorLog and calling its Log method. If you want to pick up
> the log currently configured, you can use ErrorLog.GetDefault(null) where
> null is allowed for HttpContext. However,I introduced a regression bug
> recently when working on issue
> 149<http://code.google.com/p/elmah/issues/detail?id=149> that
> prevented from null being passed to GetDefault but I've
> fixed<http://code.google.com/p/elmah/source/detail?r=701>that now.
> > elmah+un...@googlegroups.com <elmah%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >http://groups.google.com/group/elmah?hl=en.- Hide quoted text -
>
> - Show quoted text -
To unsubscribe from this group, send email to elmah+un...@googlegroups.com.
The following error gets logged when called as below.
Elmah.ErrorLog.GetDefault(null).Log(new Error(ex));
However it does not get displayed in the elmah.axd file.
Looking at the source code in SqlErrorLog.cs line 86
string appName = Mask.NullString((string)config["applicationName"]);
The above connection string has not been passed with application name
and results in string.emtpy. The stored procedure fails when called
with application name as emtpty string.
I changed the web.config to
<errorLog type="Elmah.SqlErrorLog, Elmah"
connectionString="Server=.;Database=elmahdb;Trusted_Connection=True;"
applicationName="MyApp"/>
Having set the application name in the config file, logs and displays
all the errors in the display logs correctly.
Setting the applicationName has resolved my problem.
Thanks
On Jan 26, 7:30 pm, Atif Aziz <aziza...@gmail.com> wrote:
> I just run a test with SqlErrorLog backed by a database in SQL Server
> Express from the console and it seems to be working fine...
>
> IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4200
> Type "help", "copyright", "credits" or "license" for more information.>>> import clr
> >>> clr.AddReference('Elmah')
> >>> from System import ApplicationException
> >>> from System.Collections import ArrayList
> >>> from Elmah import Error, ErrorLog, SqlErrorLog
> >>> log =
>
> SqlErrorLog(r'Server=.\SQLEXPRESS;Database=ELMAH;Trusted_Connection=True')>>> log.ApplicationName = 'TestApp'
> >>> log.Log(Error(ApplicationException()))
>
> '5c92599d-46e3-4fdf-8a29-4411c214caaa'>>> errors = ArrayList()
> >>> total = log.GetErrors(0, 10, errors)
> >>> print 'Total =', total, '; Count =', errors.Count
>
> Total = 1 ; Count = 1>>> error = errors[0]
> >>> print error.Id, error.Error.Message
>
> 5C92599D-46E3-4FDF-8A29-4411C214CAAA Error in the application.
>
> - Atif
>
>
>
> On Tue, Jan 26, 2010 at 4:55 PM, Nick Berardi <nbera...@gmail.com> wrote:
> > Same issue that I found. XML seems to work fine, but SQL doesn't work for
> > me.
>
> >> elmah%2Bunsu...@googlegroups.com<elmah%252Buns...@googlegroups.com>
> >> >.
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/elmah?hl=en.-Hide quoted text -
>
> >> > - Show quoted text -
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "ELMAH" group.
> >> To post to this group, send email to el...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> elmah+un...@googlegroups.com <elmah%2Bunsu...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/elmah?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "ELMAH" group.
> > To post to this group, send email to el...@googlegroups.com.
> > To unsubscribe from this group, send email to
To unsubscribe from this group, send email to elmah+un...@googlegroups.com.
public class Global : System.Web.HttpApplication
{
protected void Session_End(object sender, EventArgs e)
{
Elmah.ErrorSignal.Get(this).Raise(...);
}
}
Original discussion of this as a documentation issue:
http://code.google.com/p/elmah/issues/detail?id=30
~Jed
Elmah.ErrorLog.GetDefault(null).Log(new Error(e));
To unsubscribe from this group and stop receiving emails from it, send an email to elmah+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
But It shows me a syntax error on GetDefault(null).
To view this discussion on the web visit https://groups.google.com/d/msgid/elmah/f84f13ae-1b04-4b93-84f0-9c4ce8cb18cb%40googlegroups.com.