JsnLog error posting in angular 4 with elmah at server side

420 Views Asked by At

We are using Asp.net Web API 2 - Server side Angular 4 in client side (angular-cli) We have integrated Elmah on the server side for error handling. We have integrated Jsnlog in the client side.

Our angular released version is hosted in http://ng.local.com and API released version is hotsed in http://api.local.com/. Now, We have gone through the docs of Jsnlog configuration. But, facing issue in error posting to the server (to our api released http://api.local.com/) i.e missing some configuration.

Can anyone know the configuration for Jsnlog to have the URL of the API server.

1

There are 1 best solutions below

0
txavier On

There is information found here to configure the endpoint for JSNLog. Take a look at the "Configuring JSNLog" Section of this page (http://jsnlog.com/Documentation/HowTo/Angular2Logging and http://jsnlog.com/Documentation/JSNLogJs/AjaxAppender/SetOptions).

But to summarize, just add this line to your app.module.ts before the @NgModule({...

// Set the endpoint for JSNLog.

JL().setOptions({ 'appenders': [JL.createAjaxAppender('example appender').setOptions({'url': [Your Desired Endpoint Address] + '/jsnlog.logger'})] });

@NgModule({
...