{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/71290075","id":71290075,"diff_hunk":"@@ -0,0 +1,92 @@\n+package com.hazelcast.client.impl;\n+\n+import com.hazelcast.client.config.ClientConfig;\n+import com.hazelcast.client.test.TestHazelcastFactory;\n+import com.hazelcast.config.Config;\n+import com.hazelcast.core.HazelcastInstance;\n+import com.hazelcast.test.HazelcastSerialClassRunner;\n+import com.hazelcast.test.HazelcastTestSupport;\n+import com.hazelcast.test.annotation.QuickTest;\n+import org.apache.log4j.PropertyConfigurator;\n+import org.junit.After;\n+import org.junit.Test;\n+import org.junit.experimental.categories.Category;\n+import org.junit.runner.RunWith;\n+\n+import java.io.File;\n+import java.io.IOException;\n+import java.util.Properties;\n+import java.util.Scanner;\n+\n+import static org.junit.Assert.assertTrue;\n+\n+@RunWith(HazelcastSerialClassRunner.class)\n+@Category({QuickTest.class})\n+public class ClientLoggerConfigurationTest extends HazelcastTestSupport {\n+\n+    private static TestHazelcastFactory hazelcastFactory;\n+    private static HazelcastInstance client;\n+    private final String RANDOM_STRING = randomString();\n+    private final String LOG_FILENAME = randomString();\n+    private File logFile;\n+\n+    @After\n+    public void deleteLogFile () {\n+        System.clearProperty(\"hazelcast.logging.type\");\n+        logFile = new File(\"./\" + LOG_FILENAME);\n+        logFile.delete();\n+    }\n+\n+    @Test\n+    public void testProgrammaticConfiguration() throws IOException {\n+        testLoggingWithConfiguration(true);\n+    }\n+\n+    @Test\n+    public void testSystemPropertyConfiguration() throws IOException{\n+        testLoggingWithConfiguration(false);\n+    }\n+\n+    // Test with programmatic or system property configuration according to boolean parameter.\n+    protected void testLoggingWithConfiguration(boolean programmaticConfiguration) throws IOException {\n+\n+        hazelcastFactory = new TestHazelcastFactory();\n+        Config cg = new Config();\n+        cg.setProperty( \"hazelcast.logging.type\", \"jdk\" );\n+        hazelcastFactory.newHazelcastInstance(cg);\n+\n+        //Setting log4j properties for logging to a file.\n+        Properties props = new Properties();\n+        props.setProperty(\"log4j.rootLogger\" , \"INFO, FILE\");\n+        props.setProperty(\"log4j.appender.FILE\" , \"org.apache.log4j.FileAppender\");\n+        props.setProperty(\"log4j.appender.FILE.layout\" , \"org.apache.log4j.PatternLayout\");\n+        props.setProperty(\"log4j.appender.FILE.layout.ConversionPattern\",RANDOM_STRING + \"\\n\");\n+        props.setProperty(\"log4j.appender.FILE.File\",\"./\" + LOG_FILENAME);\n+        props.setProperty(\"log4j.appender.FILE.ImmediateFlush\" , \"true\");\n+        PropertyConfigurator.configure(props);\n+\n+        ClientConfig config = new ClientConfig() ;\n+        if (programmaticConfiguration) {\n+            config.setProperty( \"hazelcast.logging.type\", \"log4j\" );\n+        }\n+        else {\n+            System.setProperty( \"hazelcast.logging.type\", \"log4j\" );","path":"hazelcast-client/src/test/java/com/hazelcast/client/impl/ClientLoggerConfigurationTest.java","position":73,"original_position":73,"commit_id":"3dbfd49737cd9b9c5179ebf0edd9d7dcdc38a769","original_commit_id":"3dbfd49737cd9b9c5179ebf0edd9d7dcdc38a769","user":{"login":"mustafaiman","id":6582349,"avatar_url":"https://avatars.githubusercontent.com/u/6582349?v=3","gravatar_id":"","url":"https://api.github.com/users/mustafaiman","html_url":"https://github.com/mustafaiman","followers_url":"https://api.github.com/users/mustafaiman/followers","following_url":"https://api.github.com/users/mustafaiman/following{/other_user}","gists_url":"https://api.github.com/users/mustafaiman/gists{/gist_id}","starred_url":"https://api.github.com/users/mustafaiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustafaiman/subscriptions","organizations_url":"https://api.github.com/users/mustafaiman/orgs","repos_url":"https://api.github.com/users/mustafaiman/repos","events_url":"https://api.github.com/users/mustafaiman/events{/privacy}","received_events_url":"https://api.github.com/users/mustafaiman/received_events","type":"User","site_admin":false},"body":"It's there in @After method https://github.com/hazelcast/hazelcast/pull/8518/files/3dbfd49737cd9b9c5179ebf0edd9d7dcdc38a769#diff-b6637b9e63e43d28f960bce3b78b5349R35","created_at":"2016-07-19T08:15:11Z","updated_at":"2016-07-19T08:15:11Z","html_url":"https://github.com/hazelcast/hazelcast/pull/8518#discussion_r71290075","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/71290075"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/8518#discussion_r71290075"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518"}}},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518","id":77431273,"html_url":"https://github.com/hazelcast/hazelcast/pull/8518","diff_url":"https://github.com/hazelcast/hazelcast/pull/8518.diff","patch_url":"https://github.com/hazelcast/hazelcast/pull/8518.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/8518","number":8518,"state":"closed","locked":false,"title":"Fix for programmatic configuration of logging in client","user":{"login":"oguzdemir","id":16037069,"avatar_url":"https://avatars.githubusercontent.com/u/16037069?v=3","gravatar_id":"","url":"https://api.github.com/users/oguzdemir","html_url":"https://github.com/oguzdemir","followers_url":"https://api.github.com/users/oguzdemir/followers","following_url":"https://api.github.com/users/oguzdemir/following{/other_user}","gists_url":"https://api.github.com/users/oguzdemir/gists{/gist_id}","starred_url":"https://api.github.com/users/oguzdemir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oguzdemir/subscriptions","organizations_url":"https://api.github.com/users/oguzdemir/orgs","repos_url":"https://api.github.com/users/oguzdemir/repos","events_url":"https://api.github.com/users/oguzdemir/events{/privacy}","received_events_url":"https://api.github.com/users/oguzdemir/received_events","type":"User","site_admin":false},"body":"fixes https://github.com/hazelcast/hazelcast/issues/7764\r\n\r\n","created_at":"2016-07-14T10:13:08Z","updated_at":"2016-07-19T08:15:11Z","closed_at":"2016-07-19T08:08:34Z","merged_at":"2016-07-19T08:08:34Z","merge_commit_sha":"bf089b2f41e403e077348a83875a0ebf722f4390","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/70","html_url":"https://github.com/hazelcast/hazelcast/milestones/3.7","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/70/labels","id":1346433,"number":70,"title":"3.7","description":"","creator":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars.githubusercontent.com/u/105243?v=3","gravatar_id":"","url":"https://api.github.com/users/pveentjer","html_url":"https://github.com/pveentjer","followers_url":"https://api.github.com/users/pveentjer/followers","following_url":"https://api.github.com/users/pveentjer/following{/other_user}","gists_url":"https://api.github.com/users/pveentjer/gists{/gist_id}","starred_url":"https://api.github.com/users/pveentjer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pveentjer/subscriptions","organizations_url":"https://api.github.com/users/pveentjer/orgs","repos_url":"https://api.github.com/users/pveentjer/repos","events_url":"https://api.github.com/users/pveentjer/events{/privacy}","received_events_url":"https://api.github.com/users/pveentjer/received_events","type":"User","site_admin":false},"open_issues":34,"closed_issues":868,"state":"open","created_at":"2015-10-09T12:16:13Z","updated_at":"2016-07-19T08:08:34Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/8518/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/3dbfd49737cd9b9c5179ebf0edd9d7dcdc38a769","head":{"label":"oguzdemir:fixLogging","ref":"fixLogging","sha":"3dbfd49737cd9b9c5179ebf0edd9d7dcdc38a769","user":{"login":"oguzdemir","id":16037069,"avatar_url":"https://avatars.githubusercontent.com/u/16037069?v=3","gravatar_id":"","url":"https://api.github.com/users/oguzdemir","html_url":"https://github.com/oguzdemir","followers_url":"https://api.github.com/users/oguzdemir/followers","following_url":"https://api.github.com/users/oguzdemir/following{/other_user}","gists_url":"https://api.github.com/users/oguzdemir/gists{/gist_id}","starred_url":"https://api.github.com/users/oguzdemir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oguzdemir/subscriptions","organizations_url":"https://api.github.com/users/oguzdemir/orgs","repos_url":"https://api.github.com/users/oguzdemir/repos","events_url":"https://api.github.com/users/oguzdemir/events{/privacy}","received_events_url":"https://api.github.com/users/oguzdemir/received_events","type":"User","site_admin":false},"repo":{"id":61831503,"name":"hazelcast","full_name":"oguzdemir/hazelcast","owner":{"login":"oguzdemir","id":16037069,"avatar_url":"https://avatars.githubusercontent.com/u/16037069?v=3","gravatar_id":"","url":"https://api.github.com/users/oguzdemir","html_url":"https://github.com/oguzdemir","followers_url":"https://api.github.com/users/oguzdemir/followers","following_url":"https://api.github.com/users/oguzdemir/following{/other_user}","gists_url":"https://api.github.com/users/oguzdemir/gists{/gist_id}","starred_url":"https://api.github.com/users/oguzdemir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oguzdemir/subscriptions","organizations_url":"https://api.github.com/users/oguzdemir/orgs","repos_url":"https://api.github.com/users/oguzdemir/repos","events_url":"https://api.github.com/users/oguzdemir/events{/privacy}","received_events_url":"https://api.github.com/users/oguzdemir/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/oguzdemir/hazelcast","description":"Open Source In-Memory Data Grid","fork":true,"url":"https://api.github.com/repos/oguzdemir/hazelcast","forks_url":"https://api.github.com/repos/oguzdemir/hazelcast/forks","keys_url":"https://api.github.com/repos/oguzdemir/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oguzdemir/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oguzdemir/hazelcast/teams","hooks_url":"https://api.github.com/repos/oguzdemir/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/oguzdemir/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/oguzdemir/hazelcast/events","assignees_url":"https://api.github.com/repos/oguzdemir/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/oguzdemir/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/oguzdemir/hazelcast/tags","blobs_url":"https://api.github.com/repos/oguzdemir/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oguzdemir/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oguzdemir/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/oguzdemir/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oguzdemir/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/oguzdemir/hazelcast/languages","stargazers_url":"https://api.github.com/repos/oguzdemir/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/oguzdemir/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/oguzdemir/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/oguzdemir/hazelcast/subscription","commits_url":"https://api.github.com/repos/oguzdemir/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/oguzdemir/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/oguzdemir/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/oguzdemir/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/oguzdemir/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/oguzdemir/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oguzdemir/hazelcast/merges","archive_url":"https://api.github.com/repos/oguzdemir/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oguzdemir/hazelcast/downloads","issues_url":"https://api.github.com/repos/oguzdemir/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/oguzdemir/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/oguzdemir/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/oguzdemir/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oguzdemir/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/oguzdemir/hazelcast/releases{/id}","deployments_url":"https://api.github.com/repos/oguzdemir/hazelcast/deployments","created_at":"2016-06-23T19:35:05Z","updated_at":"2016-06-23T19:35:19Z","pushed_at":"2016-07-18T13:47:19Z","git_url":"git://github.com/oguzdemir/hazelcast.git","ssh_url":"git@github.com:oguzdemir/hazelcast.git","clone_url":"https://github.com/oguzdemir/hazelcast.git","svn_url":"https://github.com/oguzdemir/hazelcast","homepage":"www.hazelcast.com","size":95090,"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":"hazelcast:master","ref":"master","sha":"e6be9c98384c4ecb4c2f6ccace0c463d0b9e067a","user":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"repo":{"id":3786237,"name":"hazelcast","full_name":"hazelcast/hazelcast","owner":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hazelcast/hazelcast","description":"Open Source In-Memory Data Grid","fork":false,"url":"https://api.github.com/repos/hazelcast/hazelcast","forks_url":"https://api.github.com/repos/hazelcast/hazelcast/forks","keys_url":"https://api.github.com/repos/hazelcast/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hazelcast/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hazelcast/hazelcast/teams","hooks_url":"https://api.github.com/repos/hazelcast/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/hazelcast/hazelcast/events","assignees_url":"https://api.github.com/repos/hazelcast/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/hazelcast/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/hazelcast/hazelcast/tags","blobs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hazelcast/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/hazelcast/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/hazelcast/hazelcast/languages","stargazers_url":"https://api.github.com/repos/hazelcast/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/hazelcast/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/hazelcast/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/hazelcast/hazelcast/subscription","commits_url":"https://api.github.com/repos/hazelcast/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/hazelcast/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/hazelcast/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/hazelcast/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hazelcast/hazelcast/merges","archive_url":"https://api.github.com/repos/hazelcast/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hazelcast/hazelcast/downloads","issues_url":"https://api.github.com/repos/hazelcast/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/hazelcast/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/hazelcast/hazelcast/releases{/id}","deployments_url":"https://api.github.com/repos/hazelcast/hazelcast/deployments","created_at":"2012-03-21T12:25:18Z","updated_at":"2016-07-18T10:09:51Z","pushed_at":"2016-07-19T08:08:34Z","git_url":"git://github.com/hazelcast/hazelcast.git","ssh_url":"git@github.com:hazelcast/hazelcast.git","clone_url":"https://github.com/hazelcast/hazelcast.git","svn_url":"https://github.com/hazelcast/hazelcast","homepage":"www.hazelcast.com","size":129579,"stargazers_count":1638,"watchers_count":1638,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":774,"mirror_url":null,"open_issues_count":526,"forks":774,"open_issues":526,"watchers":1638,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/8518"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/8518"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/8518/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8518/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast/statuses/3dbfd49737cd9b9c5179ebf0edd9d7dcdc38a769"}}}}
{"actor":{"display_login":"mustafaiman"}}