VMware Cloud Community
sqeezer
Contributor
Contributor

Log to the workflow "Log" tab from plugin classes

Hi guys,

I wonder if it's possible to log the information in the orchestrator clients workflow "Log" tab from the model or plugin java classes? I was trying to log4j with "SCRIPTING_LOG" Cathegory and it writes in the sripting-log file, but the client seems doesn't see that lines.

Which java classes should I use to logs is going to be appeared in the workflow logs tab, like System.log does?

Thanks,

Reply
0 Kudos
6 Replies
tschoergez
Leadership
Leadership

Hi!

In workflow scripting elements and actions you can log to the log tab via Server.log()...

I don't know if that is possible in plugins (and unfortunately there is not a lot of documentation for plugin-developers out there).

Do you have an sample from an existing plugins/mehtod/action which writes to the log tab?

regards,

Joerg

Reply
0 Kudos
admin
Immortal
Immortal

Hi,

If I understand your ques correctly, you can use the org.apache.log4j.Logger class to log the information in logs.  This ahs also been implemented to default SolarSystem plugin. You cn have a look there!

Reply
0 Kudos
sqeezer
Contributor
Contributor

Hi,

I have model class, which is mapped to script object in vso.xml.

<object script-name="SimpleObject" java-class="cc.co.sqeezer.model.SimpleObject" create="false" strict="true">
            <description>Just a SimpleObject</description>
            <attributes>
                 ... 

            </attributes>
            <methods>
               
                <method script-name="Log" java-name="log">
                    <description>Logs info into standart plugin output</description>
                    <parameters>
                        <parameter name="logInfo" type="string">Log info</parameter>
                    </parameters>
                </method>
            </methods>
        </object>

public class SimpleObject {

     public void log (String logInfo) {

          // Some code should be inserted here to log to the clients 'log' tab.

     }

}

What do I want is to call SimpleObject.log("Hello World") in the workflow or in the plugin java classes and "Hello World" must be appeared in the "Logs" tab of the orchestrator client (Workflow (Run result) -> Shema -> Logs). Similar functionality scripting element System.log does. I was digging through orchestrator libs and couldn't find any traces how System.log is implemented.

Reply
0 Kudos
sqeezer
Contributor
Contributor

if I use log4j information wil go into the logs files (server.log or script-logs.log) directly and client doesn't seem to know anything about these logs. But I would like that these logs will be shown in the client's "Logs" tab of the workflow run results.

Reply
0 Kudos
tschoergez
Leadership
Leadership

Do you have an example from another plugin which does what you want?

(to proove that it's possible at all to use access the Server.xxx()-methods inside plugins, and to have a path to further investigations)

Reply
0 Kudos
sqeezer
Contributor
Contributor

Hm. No, I don't have such an example. This is my first plugin and I have SolarSystem plugin example only.

Reply
0 Kudos