cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
146
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: Asher Schweigart on 27-11-2013 01:53:38 PM
I thought I had seen this on the forums before, but I can't seem to find it, so maybe I am thinking of something else.

Is there a way to write to the Activity logger (and the Error logger as well I guess) from withing a custom element?

Subject: RE: New Message from Asher Schweigart in Customer Voice Portal (CVP) - CVP
Replied by: Hemal Mehta on 27-11-2013 02:11:51 PM
You can use the addToLog method from elementAPI, DecisionElementData, ActionEl,….  to write to activity log.
Hemal

From: Cisco Developer Community Forums [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 1:54 PM
To: [email protected]
Subject: New Message from Asher Schweigart in Customer Voice Portal (CVP) - CVP - All Versions: Custom Element Activity log

Asher Schweigart has created a new message in the forum "CVP - All Versions": -------------------------------------------------------------- I thought I had seen this on the forums before, but I can't seem to find it, so maybe I am thinking of something else.

Is there a way to write to the Activity logger (and the Error logger as well I guess) from withing a custom element?
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/community/-/message_boards/view_message/21789419 or simply reply to this email.

Subject: Re: New Message from Asher Schweigart in Customer Voice Portal (CVP) - CVP
Replied by: Janine Graves on 27-11-2013 02:40:51 PM
to write to the Error log, I believe you have to throw the AudiumException or ElementException. On 11/27/2013 2:53 PM, Cisco Developer Community Forums wrote: Asher Schweigart has created a new message in the forum "CVP - All Versions": -------------------------------------------------------------- I thought I had seen this on the forums before, but I can't seem to find it, so maybe I am thinking of something else. Is there a way to write to the Activity logger (and the Error logger as well I guess) from withing a custom element? -- To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/community/-/message_boards/view_message/21789419 or simply reply to this email. -- Janine Graves

Subject: RE: Custom Element Activity log
Replied by: Ryan Hilfers on 27-11-2013 03:32:10 PM
Janine,

There is a way, although I'm curious as to what Paul Tindall would have to say about using it (good/bad ok?).

You can import  com.audium.server.logger.EventFactory

and then throw your catched exception to: 

EventFactory.handleJavaAPIError()

That will generate an Error log entry just like an Audium Exception woudl without actually throwing one. 

handleJavaAPIError() is looking for (APIBase api, int elementType, String elementName, String message, Throwable ex)
EventFactory.handleJavaAPIError(api, 4, api.getCurrentElement(), toLog, ex);

Subject: RE: Custom Element Activity log
Replied by: Asher Schweigart on 02-12-2013 03:26:59 PM
Thanks Hemal, that's what I was looking for. 
Nice to have the Error method as well; I may use that in some other elements that I currently just save the error message text to an element variable.

Subject: RE: Custom Element Activity log
Replied by: Asher Schweigart on 02-12-2013 03:42:24 PM
I tried your method for sending it to the error log.
handleJavaAPIError() is looking for datatype "ControllerData". I'm not quite sure what that is, or what I need to import to be able to use that datatype.
Also, do you have any idea what the elementType integer refers to? Is there a chart somewhere that show the numbers that correspond to the different element types?

Subject: RE: Custom Element Activity log
Replied by: Ryan Hilfers on 02-12-2013 03:57:40 PM
Asher Schweigart:
I tried your method for sending it to the error log.
handleJavaAPIError() is looking for datatype "ControllerData". I'm not quite sure what that is, or what I need to import to be able to use that datatype.
Also, do you have any idea what the elementType integer refers to? Is there a chart somewhere that show the numbers that correspond to the different element types

Asher,  

You can also pass handleJavaAPIError() an instance of ComponentAPI (aka SessionAPI), from which it will get the controller data. handleJavaAPIError() is just an overloaded method in the EventFactory class.

the int to pass represents the component type. You can just pass a 4 for a standard element. I cant recall where this is defined.

None of this is in the Javadocs, thus the reason I was wondering what Paul would say on the usage of the method, but the EventFactory class is in the framework.jar along with the rest of the Audium API, so not sure about support caveats etc.... I would assume using the method directly is unsupported.  not sure. 
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links