1.5 Get Logs


By the method GetLogs you can retrieve the list of Logs from Monitoring.

Parameters
fromDate
Type: Date
starting date of log.

Parameters
toDate
Type: Date
end date of log.


/// WsMonitoring.GetLogs Method (c# .NET)
public static string GetLogs(WsMonitoringClient client,
    DateTime fromDate, DateTime toDate)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
 // create the request object
 GetLogEntity request = new GetLogEntity();
 request.From = fromDate;
 request.To = toDate;

 // call method GetLogs 
 // obtaining a WsResultOfArrayOfMonitoringLogEntity item
 WsResultOfArrayOfMonitoringLogEntity result =
     client.GetLogs(request);

 // if the call is Success print returned values
 if (result.Success)
 {
     stringBuilder.Append("Operation ends successfully\n");

     // get Value returned from server
     MonitoringLogEntity[] items = result.Value;

     // for each item print the information
     foreach (MonitoringLogEntity item in items)
     {
  stringBuilder.Append("\nJobID: ");
  stringBuilder.Append(item.JobID);
  stringBuilder.Append("\nResourceId: ");
  stringBuilder.Append(item.ResourceId);
  stringBuilder.Append("\nOperationName: ");
  stringBuilder.Append(item.OperationName);
     }
 }
 else
 {
     throw new ApplicationException(result.ResultMessage);
 }
    }
    catch (Exception ex)
    {
 // re-run the error
 throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// WsMonitoring.GetLogs Method (JAVA)
public static String GetLogs(IWsMonitoring client, XMLGregorianCalendar fromDate, 
    XMLGregorianCalendar toDate) 
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
 .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
 .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try 
    {
        GetLogEntity getLogEntity = new GetLogEntity();
        getLogEntity.setFrom(fromDate);
        getLogEntity.setTo(toDate);
        // call method GetMonitoringIPAddress 
        // obtaining a WsResultOfArrayOfMonitoringIPAddressEntity item
        WsResultOfArrayOfMonitoringLogEntity result = client.getLogs(getLogEntity);

        //if the call is Success print values
        if (result.isSuccess()) 
 {
     ArrayOfMonitoringLogEntity items = result.getValue(); 
     List monitoringLogEntity = 
  items.getMonitoringLogEntity();
 
     for (Iterator it = 
  monitoringLogEntity.iterator(); it.hasNext();)
     {
         MonitoringLogEntity item = it.next();
         stringBuilder.append("\nJobID: ");
         stringBuilder.append(item.getJobID());
         stringBuilder.append("\nResourceId: ");
         stringBuilder.append(item.getResourceId());
         stringBuilder.append("\nOperationName: ");
         stringBuilder.append(item.getOperationName());
            }
        } 
        else 
        {
     throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) 
    {
        System.out.println(ex);
    }

return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.services.cloud.it/wsMonitoring/v2.8/wsMonitoring.svc?wsdl
See also