简体   繁体   中英

JsnLog error posting in angular 4 with elmah at server side

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/ ) ie missing some configuration.

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

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({
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM