{"action":"created","issue":{"url":"https://api.github.com/repos/gradle/gradle/issues/7530","repository_url":"https://api.github.com/repos/gradle/gradle","labels_url":"https://api.github.com/repos/gradle/gradle/issues/7530/labels{/name}","comments_url":"https://api.github.com/repos/gradle/gradle/issues/7530/comments","events_url":"https://api.github.com/repos/gradle/gradle/issues/7530/events","html_url":"https://github.com/gradle/gradle/issues/7530","id":374004692,"node_id":"MDU6SXNzdWUzNzQwMDQ2OTI=","number":7530,"title":"Gradle's built in Logger should use `getDisplayName` when logging Describables","user":{"login":"wolfs","id":423186,"node_id":"MDQ6VXNlcjQyMzE4Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/423186?v=4","gravatar_id":"","url":"https://api.github.com/users/wolfs","html_url":"https://github.com/wolfs","followers_url":"https://api.github.com/users/wolfs/followers","following_url":"https://api.github.com/users/wolfs/following{/other_user}","gists_url":"https://api.github.com/users/wolfs/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfs/subscriptions","organizations_url":"https://api.github.com/users/wolfs/orgs","repos_url":"https://api.github.com/users/wolfs/repos","events_url":"https://api.github.com/users/wolfs/events{/privacy}","received_events_url":"https://api.github.com/users/wolfs/received_events","type":"User","site_admin":false},"labels":[{"id":429494937,"node_id":"MDU6TGFiZWw0Mjk0OTQ5Mzc=","url":"https://api.github.com/repos/gradle/gradle/labels/in:logging","name":"in:logging","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-25T15:26:25Z","updated_at":"2018-10-25T15:30:10Z","closed_at":null,"author_association":"MEMBER","body":"Many things in Gradle's code base implement `Describable`. The `displayName` is expected to be a human readable description. This description should be used when logging things automatically.\r\n\r\nSo let's say your code does the following:\r\n```\r\nLogger logger = LoggerFactory.getLogger(MyClass.class);\r\nDescribable myDescribable;\r\nlogger.info(\"This should log the display name of {}\", myDescribable);\r\n```\r\n\r\n### Expected Behavior\r\nThe display name of `myDescribable` is logged when the info log is enabled\r\n\r\n### Current Behavior\r\nThe result of `toString()` of `myDescribable is logged.\r\n\r\n### Context\r\nCurrently, if you want to log the display name and not evaluate the display name if logging is disabled since it may be expensive you need to do something like\r\n```\r\nif (logger.isInfoEnabled()) {\r\n    logger.log(\"My info is {}.\", describable.getDisplayName());\r\n}\r\n```\r\n\r\nThat is annoying and error prone."},"comment":{"url":"https://api.github.com/repos/gradle/gradle/issues/comments/433097348","html_url":"https://github.com/gradle/gradle/issues/7530#issuecomment-433097348","issue_url":"https://api.github.com/repos/gradle/gradle/issues/7530","id":433097348,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzA5NzM0OA==","user":{"login":"lptr","id":495366,"node_id":"MDQ6VXNlcjQ5NTM2Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/495366?v=4","gravatar_id":"","url":"https://api.github.com/users/lptr","html_url":"https://github.com/lptr","followers_url":"https://api.github.com/users/lptr/followers","following_url":"https://api.github.com/users/lptr/following{/other_user}","gists_url":"https://api.github.com/users/lptr/gists{/gist_id}","starred_url":"https://api.github.com/users/lptr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lptr/subscriptions","organizations_url":"https://api.github.com/users/lptr/orgs","repos_url":"https://api.github.com/users/lptr/repos","events_url":"https://api.github.com/users/lptr/events{/privacy}","received_events_url":"https://api.github.com/users/lptr/received_events","type":"User","site_admin":false},"created_at":"2018-10-25T15:30:10Z","updated_at":"2018-10-25T15:30:10Z","author_association":"MEMBER","body":"This is a great idea. Whoever implements this should check all the places where we wrap logger calls with `if (LOGGER.isXxxEnabled()) { ... }` only because of a describable, and unwrap the call there."}}
{"actor":{"display_login":"lptr"}}