Forum Discussion

deangiblin's avatar
deangiblin
Occasional Contributor
14 years ago

is there a way to reduce the log file size

i went to post my log to jira. i just selected the "attach TestComplete Log"



and it comes back with The attached file is too large. It can't be greater than 800 Kb.



is there a way to reduce the size of the log???

9 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor
    I have at least 2 better solutions than to reduce the size of TC log :)


    1. contact your Jira administrator and ask him to increase allowed size of the attachments

    2. place log files somewhere (shared folder on a server, for example) and post link to the file in Jira


    As for the reducing the log file size... In your case the easiest way is to disable Visualizer (Tools - Options - Engines - Visualizer, disable both checkboxes). This should help



    Another solution is to pack log file to archive (e.g. ZIP)
  • deangiblin's avatar
    deangiblin
    Occasional Contributor
    ive set the attachments on jira to 2GB but still getting error message saying file is bigger than 800kb????
  • deangiblin's avatar
    deangiblin
    Occasional Contributor
    yes can do that but still i have a 2gb capacity now and TC seems to think i only have 800kb so doesnt really answer the question


  • Hi Dean,






    The restriction is caused by an odd issue of JIRA. When attaching a file using the JIRA Remote API, this API converts every single byte of the attached file into a long string. For example, the 'D' character is sent by this string:


    <multiRef id="id8" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:byte" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">69</multiRef>






    As you understand, even a small file with the size of about 800 Kb grows up to tens of Megabytes when sent to JIRA. They have an open case regarding this behavior.
  • So what's the status of this now? I get the impression that the SOAP API
    isn't being maintained by Atlassian, so will TestComplete be able to
    use the REST API?



    At the moment being able to raise a JIRA issue from TestComplete is nice
    but not much more than a gimmick if the log can't be attached or linked to automatically.

  • Hi Nick,



    At the moment, we do not have plans to move to the REST API. However, I have registered your request as a suggestion. Thank you.



    As for the problem with attachments, I will check the status and report here.







  • So, rather than just complain, I've been playing around with a JScript in TestComplete to talk to the JIRA JSON-RPC API



    So here are some routines, culminating in creating an issue.

    I apologise for all the callbacks, but that's the nature of the beast.

    (The JSON unit contains the text of Crockford's json2.js script)



    Now all I need to do is parse the log at the end of a run and send it through as the new bug description...



    function JIRA_POST(message, cb) {

        var baseURL = "http://10.15.10.81:8181/rpc/json-rpc/jirasoapservice-v2",      

            XmlHttpRequest = Sys["OleObject"]("MSXML2.XMLHTTP.3.0");

        XmlHttpRequest.open("POST", baseURL, false);

        XmlHttpRequest.setRequestHeader("Content-Type","application/json");  

        XmlHttpRequest.onreadystatechange = function () {

            if (XmlHttpRequest.readyState === 4) {

                cb(JSON.JSON.parse(XmlHttpRequest.responseText));

                XmlHttpRequest = null;

            }

        };  

        XmlHttpRequest.send(message);

    }



    function JIRA_LOGIN(cb) {

        var login = JIRA_POST('{"jsonrpc": "2.0", "method": "login", "params": ["jiraadmin", "JIRAadmin"], "id": "12345"}', function (login) {

            Log.Message(login.result);

            cb && cb(login);

        });

    }



    function JIRA_SYSINFO(cb) {

        JIRA_LOGIN(function (login) {

            JIRA_POST('{"jsonrpc": "2.0", "method": "getServerInfo", "params": ["' + login.result + '"], "id": "12345"}', function (sysinfo) {

                cb && cb(sysinfo);

            });

        });

    }



    function TEST_JIRA_SYSINFO() {

        JIRA_SYSINFO(function (sysinfo) {

            Log.Message(sysinfo.result.version);

        });

    }



    function JIRA_GETISSUE(issue, cb) {

        JIRA_LOGIN(function (login) {

            JIRA_POST('{"jsonrpc": "2.0", "method": "getIssue", "params": ["' + login.result + '", "' + issue + '"], "id": "12345"}', function (sysinfo) {

                cb && cb(sysinfo);

            });

        });

    }



    function TEST_JIRA_GETISSUE() {

        JIRA_GETISSUE("EVAL-1", function (sysinfo) {

            Log.Message(sysinfo.result.description);

        });

    }



    function JIRA_CREATEISSUE(issueDetails, cb) {

        JIRA_LOGIN(function (login) {

            var newIssue = {

                "jsonrpc": "2.0",

                "method": "createIssue",

                "params": [login.result, issueDetails],

                "id": "12345"};

            JIRA_POST(JSON.JSON.stringify(newIssue), function (issueInfo) {

                cb && cb(issueInfo);

            });

        });

    }



    function TEST_JIRA_CREATEISSUE() {

        var newIssueDetails = {

            "summary": "Another bug from TC",

            "type": "1",

            "description": "I am still surprised that this works",

            "project": "EVAL"

        }

        JIRA_CREATEISSUE(newIssueDetails, function (issueInfo) {

            Log.Message(issueInfo.result.key);

        });    

    }

  • Hi Nick,



    Thank you for information. We have looked into a possibility to move to this API and decided to register this as a suggestion. Also, we are going to use another way of attaching files that should solve the problem with large attachments in one of the future updates of the tool.