{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/79821049","id":79821049,"diff_hunk":"@@ -240,53 +251,141 @@ public void findBadLoggerUsages(MethodNode methodNode) {\n                     LineNumberNode lineNumberNode = (LineNumberNode) insn;\n                     lineNumber = lineNumberNode.line;\n                 }\n-                if (insn.getOpcode() == Opcodes.INVOKEVIRTUAL) {\n+                if (insn.getOpcode() == Opcodes.INVOKEINTERFACE) {\n                     MethodInsnNode methodInsn = (MethodInsnNode) insn;\n-                    if (Type.getObjectType(methodInsn.owner).getClassName().equals(LOGGER_CLASS) == false) {\n-                        continue;\n-                    }\n-                    if (LOGGER_METHODS.contains(methodInsn.name) == false) {\n-                        continue;\n-                    }\n-                    BasicValue varArgsSizeObject = getStackValue(arraySizeFrames[i], 0); // last argument\n-                    if (varArgsSizeObject instanceof ArraySizeBasicValue == false) {\n-                        wrongUsageCallback.accept(new WrongLoggerUsage(className, methodNode.name, methodInsn.name, lineNumber,\n-                            \"Could not determine size of varargs array\"));\n-                        continue;\n-                    }\n-                    ArraySizeBasicValue varArgsSize = (ArraySizeBasicValue) varArgsSizeObject;\n-                    Type[] argumentTypes = Type.getArgumentTypes(methodInsn.desc);\n-                    BasicValue logMessageLengthObject = getStackValue(stringFrames[i], argumentTypes.length - 1); // first argument\n-                    if (logMessageLengthObject instanceof PlaceHolderStringBasicValue == false) {\n-                        if (varArgsSize.minValue > 0) {\n-                            wrongUsageCallback.accept(new WrongLoggerUsage(className, methodNode.name, methodInsn.name, lineNumber,\n-                                \"First argument must be a string constant so that we can statically ensure proper place holder usage\"));\n+                    if (Type.getObjectType(methodInsn.owner).equals(LOGGER_CLASS)) {\n+                        if (LOGGER_METHODS.contains(methodInsn.name) == false) {\n                             continue;\n+                        }\n+\n+                        Type[] argumentTypes = Type.getArgumentTypes(methodInsn.desc);\n+                        int markerOffset = 0;\n+                        if (argumentTypes[0].equals(MARKER_CLASS)) {\n+                            markerOffset = 1;\n+                        }\n+\n+                        int lengthWithoutMarker = argumentTypes.length - markerOffset;\n+\n+                        if (lengthWithoutMarker == 2 &&\n+                            argumentTypes[markerOffset + 0].equals(STRING_CLASS) &&\n+                            (argumentTypes[markerOffset + 1].equals(OBJECT_ARRAY_CLASS) ||\n+                                argumentTypes[markerOffset + 1].equals(SUPPLIER_ARRAY_CLASS))) {\n+                            // VARARGS METHOD: debug(Marker?, String, (Object...|Supplier...))\n+                            checkArrayArgs(methodNode, logMessageFrames[i], arraySizeFrames[i], lineNumber, methodInsn, markerOffset + 0,","path":"test/logger-usage/src/main/java/org/elasticsearch/test/loggerusage/ESLoggerUsageChecker.java","position":93,"original_position":93,"commit_id":"de2daa3e3166dc870504ec41154ebbcc9991233a","original_commit_id":"de2daa3e3166dc870504ec41154ebbcc9991233a","user":{"login":"ywelsch","id":3718355,"avatar_url":"https://avatars.githubusercontent.com/u/3718355?v=3","gravatar_id":"","url":"https://api.github.com/users/ywelsch","html_url":"https://github.com/ywelsch","followers_url":"https://api.github.com/users/ywelsch/followers","following_url":"https://api.github.com/users/ywelsch/following{/other_user}","gists_url":"https://api.github.com/users/ywelsch/gists{/gist_id}","starred_url":"https://api.github.com/users/ywelsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywelsch/subscriptions","organizations_url":"https://api.github.com/users/ywelsch/orgs","repos_url":"https://api.github.com/users/ywelsch/repos","events_url":"https://api.github.com/users/ywelsch/events{/privacy}","received_events_url":"https://api.github.com/users/ywelsch/received_events","type":"User","site_admin":false},"body":"I wanted it to be more visual that this is the \"first argument (= 0)\" when ignoring the marker. I can remove it if you like, I don't have a strong preference on this.","created_at":"2016-09-21T12:27:51Z","updated_at":"2016-09-21T12:27:51Z","html_url":"https://github.com/elastic/elasticsearch/pull/20490#discussion_r79821049","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/79821049"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/20490#discussion_r79821049"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490","id":85307813,"html_url":"https://github.com/elastic/elasticsearch/pull/20490","diff_url":"https://github.com/elastic/elasticsearch/pull/20490.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/20490.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20490","number":20490,"state":"open","locked":false,"title":"Fix logger usage check for Log4j 2","user":{"login":"ywelsch","id":3718355,"avatar_url":"https://avatars.githubusercontent.com/u/3718355?v=3","gravatar_id":"","url":"https://api.github.com/users/ywelsch","html_url":"https://github.com/ywelsch","followers_url":"https://api.github.com/users/ywelsch/followers","following_url":"https://api.github.com/users/ywelsch/following{/other_user}","gists_url":"https://api.github.com/users/ywelsch/gists{/gist_id}","starred_url":"https://api.github.com/users/ywelsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywelsch/subscriptions","organizations_url":"https://api.github.com/users/ywelsch/orgs","repos_url":"https://api.github.com/users/ywelsch/repos","events_url":"https://api.github.com/users/ywelsch/events{/privacy}","received_events_url":"https://api.github.com/users/ywelsch/received_events","type":"User","site_admin":false},"body":"With the switch to Log4j 2 the logger usage checker was temporarily disabled. This PR adapts the checks to work with Log4j 2 and re-enables the Gradle checks. It also fixes the wrong logger usages that have sneaked into the code base.\r\n\r\nCloses #20243 ","created_at":"2016-09-14T21:22:58Z","updated_at":"2016-09-21T12:27:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0855d2cf3033208426eb49781f31293c6907d2d","assignee":{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false},"assignees":[{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20490/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/de2daa3e3166dc870504ec41154ebbcc9991233a","head":{"label":"ywelsch:fix/loggerusagecheck-log4j2","ref":"fix/loggerusagecheck-log4j2","sha":"de2daa3e3166dc870504ec41154ebbcc9991233a","user":{"login":"ywelsch","id":3718355,"avatar_url":"https://avatars.githubusercontent.com/u/3718355?v=3","gravatar_id":"","url":"https://api.github.com/users/ywelsch","html_url":"https://github.com/ywelsch","followers_url":"https://api.github.com/users/ywelsch/followers","following_url":"https://api.github.com/users/ywelsch/following{/other_user}","gists_url":"https://api.github.com/users/ywelsch/gists{/gist_id}","starred_url":"https://api.github.com/users/ywelsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywelsch/subscriptions","organizations_url":"https://api.github.com/users/ywelsch/orgs","repos_url":"https://api.github.com/users/ywelsch/repos","events_url":"https://api.github.com/users/ywelsch/events{/privacy}","received_events_url":"https://api.github.com/users/ywelsch/received_events","type":"User","site_admin":false},"repo":{"id":43299643,"name":"elasticsearch","full_name":"ywelsch/elasticsearch","owner":{"login":"ywelsch","id":3718355,"avatar_url":"https://avatars.githubusercontent.com/u/3718355?v=3","gravatar_id":"","url":"https://api.github.com/users/ywelsch","html_url":"https://github.com/ywelsch","followers_url":"https://api.github.com/users/ywelsch/followers","following_url":"https://api.github.com/users/ywelsch/following{/other_user}","gists_url":"https://api.github.com/users/ywelsch/gists{/gist_id}","starred_url":"https://api.github.com/users/ywelsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywelsch/subscriptions","organizations_url":"https://api.github.com/users/ywelsch/orgs","repos_url":"https://api.github.com/users/ywelsch/repos","events_url":"https://api.github.com/users/ywelsch/events{/privacy}","received_events_url":"https://api.github.com/users/ywelsch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ywelsch/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/ywelsch/elasticsearch","forks_url":"https://api.github.com/repos/ywelsch/elasticsearch/forks","keys_url":"https://api.github.com/repos/ywelsch/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ywelsch/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ywelsch/elasticsearch/teams","hooks_url":"https://api.github.com/repos/ywelsch/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/ywelsch/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/ywelsch/elasticsearch/events","assignees_url":"https://api.github.com/repos/ywelsch/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/ywelsch/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/ywelsch/elasticsearch/tags","blobs_url":"https://api.github.com/repos/ywelsch/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ywelsch/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ywelsch/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/ywelsch/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ywelsch/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/ywelsch/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/ywelsch/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/ywelsch/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/ywelsch/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/ywelsch/elasticsearch/subscription","commits_url":"https://api.github.com/repos/ywelsch/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/ywelsch/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/ywelsch/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/ywelsch/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/ywelsch/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/ywelsch/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ywelsch/elasticsearch/merges","archive_url":"https://api.github.com/repos/ywelsch/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ywelsch/elasticsearch/downloads","issues_url":"https://api.github.com/repos/ywelsch/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/ywelsch/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/ywelsch/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/ywelsch/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ywelsch/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/ywelsch/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/ywelsch/elasticsearch/deployments","created_at":"2015-09-28T12:30:36Z","updated_at":"2016-08-12T13:51:10Z","pushed_at":"2016-09-16T10:56:04Z","git_url":"git://github.com/ywelsch/elasticsearch.git","ssh_url":"git@github.com:ywelsch/elasticsearch.git","clone_url":"https://github.com/ywelsch/elasticsearch.git","svn_url":"https://github.com/ywelsch/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":239971,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"f88521806334606b1802312a20624f21b68ab916","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2016-09-21T09:38:58Z","pushed_at":"2016-09-21T12:22:15Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":352170,"stargazers_count":18481,"watchers_count":18481,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6289,"mirror_url":null,"open_issues_count":1110,"forks":6289,"open_issues":1110,"watchers":18481,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/20490"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/20490"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/20490/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/20490/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/de2daa3e3166dc870504ec41154ebbcc9991233a"}}}}
{"actor":{"display_login":"ywelsch"}}