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. With that said, here's an example in showing ELMAH being used to log an error using IronPython's interactive interpreter on the console:
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 Elmah import Error, ErrorLog >>> from System import ApplicationException >>> from System.Collections import ArrayList >>> log = ErrorLog.GetDefault(None) >>> print log
<Elmah.MemoryErrorLog object at 0x000000000000002B [Elmah.MemoryErrorLog]>
On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: > Is it possible to use ELMAH to log errors in say a console app? I > haven't had too much luck getting this to work. Anybody have any > pointers.
> -- > You received this message because you are subscribed to the Google Groups > "ELMAH" group. > To post to this group, send email to elmah@googlegroups.com. > To unsubscribe from this group, send email to > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/elmah?hl=en.
I still understand the need for IIS. But I have some non-web, outside processing tools, that need to be logged and it seemed easier to just put all the logging in the same place. So that was the reason for my question.
On Tue, Jan 12, 2010 at 2: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. With that said, here's an example in showing ELMAH being used to > log an error using IronPython's interactive interpreter on the console:
> 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 Elmah import Error, ErrorLog > >>> from System import ApplicationException > >>> from System.Collections import ArrayList > >>> log = ErrorLog.GetDefault(None) > >>> print log > <Elmah.MemoryErrorLog object at 0x000000000000002B [Elmah.MemoryErrorLog]> > >>> log.Log(Error(ApplicationException())) > '79e8f86c-e82f-4051-949c-14b8a8bdcf03' > >>> 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 > 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
> - Atif
> On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote:
>> Is it possible to use ELMAH to log errors in say a console app? I >> haven't had too much luck getting this to work. Anybody have any >> pointers.
>> -- >> You received this message because you are subscribed to the Google Groups >> "ELMAH" group. >> To post to this group, send email to elmah@googlegroups.com. >> To unsubscribe from this group, send email to >> elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@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 elmah@googlegroups.com. > To unsubscribe from this group, send email to > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/elmah?hl=en.
Hi Atif Your suggested method of calling below works well using XML logger. Elmah.ErrorLog.GetDefault(null).Log(new Error(ex)); When I switch to SQL Logger it does not log any entry. Any Ideas?
On Jan 12, 7:23 am, Atif Aziz <aziza...@gmail.com> wrote:
> 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. > With that said, here's an example in showing ELMAH being used to > log an error using IronPython's interactive interpreter on the console:
> 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 Elmah import Error, ErrorLog > >>> from System import ApplicationException > >>> from System.Collections import ArrayList > >>> log = ErrorLog.GetDefault(None) > >>> print log
> <Elmah.MemoryErrorLog object at 0x000000000000002B [Elmah.MemoryErrorLog]>>>> log.Log(Error(ApplicationException()))
> 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
> - Atif
> On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: > > Is it possible to use ELMAH to log errors in say a console app? I > > haven't had too much luck getting this to work. Anybody have any > > pointers.
> > -- > > You received this message because you are subscribed to the Google Groups > > "ELMAH" group. > > To post to this group, send email to elmah@googlegroups.com. > > To unsubscribe from this group, send email to > > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > > For more options, visit this group at > >http://groups.google.com/group/elmah?hl=en.- Hide quoted text -
On Tue, Jan 26, 2010 at 7:00 AM, mhadamji <mhada...@gmail.com> wrote: > Hi Atif > Your suggested method of calling below works well using XML logger. > Elmah.ErrorLog.GetDefault(null).Log(new Error(ex)); > When I switch to SQL Logger it does not log any entry. Any Ideas?
> 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. > > With that said, here's an example in showing ELMAH being used to > > log an error using IronPython's interactive interpreter on the console:
> > 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 Elmah import Error, ErrorLog > > >>> from System import ApplicationException > > >>> from System.Collections import ArrayList > > >>> log = ErrorLog.GetDefault(None) > > >>> print log
> > <Elmah.MemoryErrorLog object at 0x000000000000002B > [Elmah.MemoryErrorLog]>>>> log.Log(Error(ApplicationException()))
> > 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
> > - Atif
> > On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: > > > Is it possible to use ELMAH to log errors in say a console app? I > > > haven't had too much luck getting this to work. Anybody have any > > > pointers.
> > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "ELMAH" group. > > > To post to this group, send email to elmah@googlegroups.com. > > > To unsubscribe from this group, send email to > > > elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com>< > elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@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 elmah@googlegroups.com. > To unsubscribe from this group, send email to > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/elmah?hl=en.
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.
> On Tue, Jan 26, 2010 at 7:00 AM, mhadamji <mhada...@gmail.com> wrote:
>> Hi Atif >> Your suggested method of calling below works well using XML logger. >> Elmah.ErrorLog.GetDefault(null).Log(new Error(ex)); >> When I switch to SQL Logger it does not log any entry. Any Ideas?
>> 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. >> > With that said, here's an example in showing ELMAH being used to >> > log an error using IronPython's interactive interpreter on the console:
>> > 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 Elmah import Error, ErrorLog >> > >>> from System import ApplicationException >> > >>> from System.Collections import ArrayList >> > >>> log = ErrorLog.GetDefault(None) >> > >>> print log
>> > <Elmah.MemoryErrorLog object at 0x000000000000002B >> [Elmah.MemoryErrorLog]>>>> log.Log(Error(ApplicationException()))
>> > 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
>> > - Atif
>> > On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: >> > > Is it possible to use ELMAH to log errors in say a console app? I >> > > haven't had too much luck getting this to work. Anybody have any >> > > pointers.
>> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "ELMAH" group. >> > > To post to this group, send email to elmah@googlegroups.com. >> > > To unsubscribe from this group, send email to >> > > elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com>< >> elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@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 elmah@googlegroups.com. >> To unsubscribe from this group, send email to >> elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@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 elmah@googlegroups.com. > To unsubscribe from this group, send email to > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/elmah?hl=en.
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.
> On Tue, Jan 26, 2010 at 7:00 AM, mhadamji <mhada...@gmail.com> wrote:
>> Hi Atif >> Your suggested method of calling below works well using XML logger. >> Elmah.ErrorLog.GetDefault(null).Log(new Error(ex)); >> When I switch to SQL Logger it does not log any entry. Any Ideas?
>> 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. >> > With that said, here's an example in showing ELMAH being used to >> > log an error using IronPython's interactive interpreter on the console:
>> > 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 Elmah import Error, ErrorLog >> > >>> from System import ApplicationException >> > >>> from System.Collections import ArrayList >> > >>> log = ErrorLog.GetDefault(None) >> > >>> print log
>> > <Elmah.MemoryErrorLog object at 0x000000000000002B >> [Elmah.MemoryErrorLog]>>>> log.Log(Error(ApplicationException()))
>> > 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
>> > - Atif
>> > On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: >> > > Is it possible to use ELMAH to log errors in say a console app? I >> > > haven't had too much luck getting this to work. Anybody have any >> > > pointers.
>> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "ELMAH" group. >> > > To post to this group, send email to elmah@googlegroups.com. >> > > To unsubscribe from this group, send email to >> > > elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com>< >> elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@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 elmah@googlegroups.com. >> To unsubscribe from this group, send email to >> elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@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 elmah@googlegroups.com. > To unsubscribe from this group, send email to > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/elmah?hl=en.
Thanks Atif I am using MS-SQL 2005 developer edition with following connection string. <errorLog type="Elmah.SqlErrorLog, Elmah" connectionString="Server=.;Database=elmahdb;Trusted_Connection=True;"/
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:
> 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.
> > On Tue, Jan 26, 2010 at 7:00 AM, mhadamji <mhada...@gmail.com> wrote:
> >> Hi Atif > >> Your suggested method of calling below works well using XML logger. > >> Elmah.ErrorLog.GetDefault(null).Log(new Error(ex)); > >> When I switch to SQL Logger it does not log any entry. Any Ideas?
> >> 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. > >> > With that said, here's an example in showing ELMAH being used to > >> > log an error using IronPython's interactive interpreter on the console:
> >> > 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 Elmah import Error, ErrorLog > >> > >>> from System import ApplicationException > >> > >>> from System.Collections import ArrayList > >> > >>> log = ErrorLog.GetDefault(None) > >> > >>> print log
> >> > 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
> >> > - Atif
> >> > On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: > >> > > Is it possible to use ELMAH to log errors in say a console app? I > >> > > haven't had too much luck getting this to work. Anybody have any > >> > > pointers.
> >> > > -- > >> > > You received this message because you are subscribed to the Google > >> Groups > >> > > "ELMAH" group. > >> > > To post to this group, send email to elmah@googlegroups.com. > >> > > To unsubscribe from this group, send email to > >> > > elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com>< > >> elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@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 elmah@googlegroups.com. > >> To unsubscribe from this group, send email to > >> elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@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 elmah@googlegroups.com. > > To unsubscribe from this group, send email to > > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > > For more options, visit this group at > >http://groups.google.com/group/elmah?hl=en.- Hide quoted text -
Glad to hear you could get it solved. Your solution is also consistent with the test I did earlier where I specifically did set the application name. If you don't set it then the problem is that ELMAH cannot infer it automatically because there is no context available. See ErrorLog.InferApplicationName for details:
ELMAH thereofre ends up using a blank for application name. The error is probably getting logged but you can't see it through the views because they filter the log based on an application name. Since the views are being served in response to a web request, the context is available for inference and a different application name is being used.
On Wed, Jan 27, 2010 at 2:42 AM, mhadamji <mhada...@gmail.com> wrote: > Thanks Atif > I am using MS-SQL 2005 developer edition with following connection > string. > <errorLog type="Elmah.SqlErrorLog, Elmah" > connectionString="Server=.;Database=elmahdb;Trusted_Connection=True;"/
> 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 =
> > 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.
> > > On Tue, Jan 26, 2010 at 7:00 AM, mhadamji <mhada...@gmail.com> wrote:
> > >> Hi Atif > > >> Your suggested method of calling below works well using XML logger. > > >> Elmah.ErrorLog.GetDefault(null).Log(new Error(ex)); > > >> When I switch to SQL Logger it does not log any entry. Any Ideas?
> > >> 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. > > >> > With that said, here's an example in showing ELMAH being used to > > >> > log an error using IronPython's interactive interpreter on the > console:
> > >> > 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 Elmah import Error, ErrorLog > > >> > >>> from System import ApplicationException > > >> > >>> from System.Collections import ArrayList > > >> > >>> log = ErrorLog.GetDefault(None) > > >> > >>> print log
> > >> > 79e8f86c-e82f-4051-949c-14b8a8bdcf03 Error in the application.
> > >> > - Atif
> > >> > On Tue, Jan 12, 2010 at 1:37 AM, Nick <nbera...@gmail.com> wrote: > > >> > > Is it possible to use ELMAH to log errors in say a console app? I > > >> > > haven't had too much luck getting this to work. Anybody have any > > >> > > pointers.
> > >> > > -- > > >> > > You received this message because you are subscribed to the Google > > >> Groups > > >> > > "ELMAH" group. > > >> > > To post to this group, send email to elmah@googlegroups.com. > > >> > > To unsubscribe from this group, send email to > > >> > > elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com> > <elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@googlegroups.co m> > >< > > >> elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@googlegroups.com > > <elmah%252Bunsubscribe@googlegroups.com<elmah%25252Bunsubscribe@googlegroup s.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 elmah@googlegroups.com. > > >> To unsubscribe from this group, send email to > > >> elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com>< > elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@googlegroups.com >
> > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "ELMAH" group. > > > To post to this group, send email to elmah@googlegroups.com. > > > To unsubscribe from this group, send email to > > > elmah+unsubscribe@googlegroups.com<elmah%2Bunsubscribe@googlegroups.com>< > elmah%2Bunsubscribe@googlegroups.com<elmah%252Bunsubscribe@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 elmah@googlegroups.com. > To unsubscribe from this group, send email to > elmah+unsubscribe@googlegroups.com <elmah%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/elmah?hl=en.