Search in sources :

Example 1 with LogDataProvider

use of com.haulmont.cuba.web.export.LogDataProvider in project cuba by cuba-platform.

the class LogDownloadOptionsWindow method downloadTail.

public void downloadTail() {
    LogDataProvider logDataProvider;
    if (remoteContextBox.isVisible()) {
        logDataProvider = new LogDataProvider(connection, logFileName, remoteContextField.getValue(), false);
    } else {
        logDataProvider = new LogDataProvider(connection, logFileName, false);
    }
    logDataProvider.obtainUrl();
    exportFile(logDataProvider, logFileName);
    close(CLOSE_ACTION_ID);
}
Also used : LogDataProvider(com.haulmont.cuba.web.export.LogDataProvider)

Example 2 with LogDataProvider

use of com.haulmont.cuba.web.export.LogDataProvider in project cuba by cuba-platform.

the class ServerLogWindow method downloadLog.

public void downloadLog() {
    final String fileName = logFileNameField.getValue();
    if (fileName != null) {
        try {
            final JmxInstance selectedConnection = getSelectedConnection();
            // check if we have many suitable JmxControlBean instances
            // show dialog with context select and size options if needed
            List<String> availableContexts = jmxRemoteLoggingAPI.getAvailableContexts(selectedConnection);
            long size = jmxRemoteLoggingAPI.getLogFileSize(selectedConnection, fileName);
            if (size <= LogArchiver.LOG_TAIL_FOR_PACKING_SIZE && availableContexts.size() == 1) {
                LogDataProvider dataProvider = new LogDataProvider(selectedConnection, fileName, availableContexts.get(0), false);
                dataProvider.obtainUrl();
                ExportDisplay exportDisplay = AppConfig.createExportDisplay(this);
                exportDisplay.show(dataProvider, fileName + ".zip");
            } else {
                openWindow("serverLogDownloadOptionsDialog", OpenType.DIALOG, ParamsMap.of("logFileName", fileName, "connection", selectedConnection, "logFileSize", size, "remoteContextList", availableContexts));
            }
        } catch (RuntimeException | LogControlException e) {
            showNotification(getMessage("exception.logControl"), NotificationType.ERROR);
            log.error("Error downloading log", e);
        }
    } else {
        showNotification(getMessage("log.notSelected"), NotificationType.HUMANIZED);
    }
}
Also used : ExportDisplay(com.haulmont.cuba.gui.export.ExportDisplay) LogControlException(com.haulmont.cuba.core.sys.logging.LogControlException) JmxInstance(com.haulmont.cuba.core.entity.JmxInstance) LogDataProvider(com.haulmont.cuba.web.export.LogDataProvider)

Example 3 with LogDataProvider

use of com.haulmont.cuba.web.export.LogDataProvider in project cuba by cuba-platform.

the class LogDownloadOptionsWindow method downloadFull.

public void downloadFull() {
    LogDataProvider logDataProvider;
    if (remoteContextBox.isVisible()) {
        logDataProvider = new LogDataProvider(connection, logFileName, remoteContextField.getValue(), true);
    } else {
        logDataProvider = new LogDataProvider(connection, logFileName, true);
    }
    logDataProvider.obtainUrl();
    exportFile(logDataProvider, logFileName);
    close(CLOSE_ACTION_ID);
}
Also used : LogDataProvider(com.haulmont.cuba.web.export.LogDataProvider)

Aggregations

LogDataProvider (com.haulmont.cuba.web.export.LogDataProvider)3 JmxInstance (com.haulmont.cuba.core.entity.JmxInstance)1 LogControlException (com.haulmont.cuba.core.sys.logging.LogControlException)1 ExportDisplay (com.haulmont.cuba.gui.export.ExportDisplay)1