{"id":113994,"date":"2022-05-19T07:00:00","date_gmt":"2022-05-19T04:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=113994"},"modified":"2022-05-16T13:38:14","modified_gmt":"2022-05-16T10:38:14","slug":"google-cloud-structured-logging-for-java-applications","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html","title":{"rendered":"Google Cloud Structured Logging for Java Applications"},"content":{"rendered":"<p>&nbsp;One advice for logging that I have seen when targeting applications to cloud platforms is to simply write to Standard Out and platform takes care of sending it to the appropriate log sinks. This mostly works except when it doesn&#8217;t &#8211; it especially doesn&#8217;t when analyzing failure scenarios. Typically for Java applications this means looking through a stack trace and each line of a stack trace is treated as a separate log entry by the log sinks, this creates these problems:<\/p>\n<ol class=\"wp-block-list\">\n<li>Correlating multiple line of output as being part of a single stack trace<\/li>\n<li>Since applications are multi-threaded even related logs may not be in just the right order<\/li>\n<li>The severity of logs is not correctly determined and so does not find its way into the Error Reporting system<\/li>\n<\/ol>\n<p>This post will go into a few approaches when logging from a Java application in Google Cloud Platform<\/p>\n<h2 class=\"wp-block-heading\">Problem<\/h2>\n<p>Let me go over the problem once more, so say I were to log the following way in Java code:<\/p>\n<div>\n<pre class=\"brush:java\">LOGGER.info(\"Hello Logging\")&nbsp;<\/pre>\n<\/div>\n<p>And it shows up the following way in the GCP Logging console<\/p>\n<div>\n<pre class=\"brush:java\">{\n  \"textPayload\": \"2022-04-29 22:00:12.057  INFO 1 --- [or-http-epoll-1] org.bk.web.GreetingsController           : Hello Logging\",\n  \"insertId\": \"626c5fec0000e25a9b667889\",\n  \"resource\": {\n    \"type\": \"cloud_run_revision\",\n    \"labels\": {\n      \"service_name\": \"hello-cloud-run-sample\",\n      \"configuration_name\": \"hello-cloud-run-sample\",\n      \"project_id\": \"biju-altostrat-demo\",\n      \"revision_name\": \"hello-cloud-run-sample-00008-qow\",\n      \"location\": \"us-central1\"\n    }\n  },\n  \"timestamp\": \"2022-04-29T22:00:12.057946Z\",\n  \"labels\": {\n    \"instanceId\": \"instanceid\"\n  },\n  \"logName\": \"projects\/myproject\/logs\/run.googleapis.com%2Fstdout\",\n  \"receiveTimestamp\": \"2022-04-29T22:00:12.077339403Z\"\n}<\/pre>\n<\/div>\n<p>This looks reasonable. Now consider the case of logging in case of an error:<\/p>\n<div>\n<pre class=\"brush:java\">{\n  \"textPayload\": \"\\t\\tat reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2068) ~[reactor-core-3.4.17.jar:3.4.17]\",\n  \"insertId\": \"626c619b00005956ab868f3f\",\n  \"resource\": {\n    \"type\": \"cloud_run_revision\",\n    \"labels\": {\n      \"revision_name\": \"hello-cloud-run-sample-00008-qow\",\n      \"project_id\": \"biju-altostrat-demo\",\n      \"location\": \"us-central1\",\n      \"configuration_name\": \"hello-cloud-run-sample\",\n      \"service_name\": \"hello-cloud-run-sample\"\n    }\n  },\n  \"timestamp\": \"2022-04-29T22:07:23.022870Z\",\n  \"labels\": {\n    \"instanceId\": \"0067430fbd3ad615324262b55e1604eb6acbd21e59fa5fadd15cb4e033adedd66031dba29e1b81d507872b2c3c6cd58a83a7f0794965f8c5f7a97507bb5b27fb33\"\n  },\n  \"logName\": \"projects\/biju-altostrat-demo\/logs\/run.googleapis.com%2Fstdout\",\n  \"receiveTimestamp\": \"2022-04-29T22:07:23.317981870Z\"\n}<\/pre>\n<\/div>\n<p>There would be multiple of these in the GCP logging console, for each line of the stack trace with no way to correlate them together. Additionally, there is no severity attached to these event and so the error would not end up with Google Cloud Error Reporting service.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2 class=\"wp-block-heading\">Configuring Logging<\/h2>\n<p>There are a few approaches to configuring logging for a Java application targeted to be deployed to Google Cloud. The simplest approach, if using<br \/><a href=\"https:\/\/logback.qos.ch\/\" target=\"_blank\" rel=\"noopener\">Logback<\/a>, is to use the<br \/><a href=\"https:\/\/github.com\/googleapis\/java-logging-logback\" target=\"_blank\" rel=\"noopener\">Logging appender<\/a> provided by Google Cloud available<br \/><a href=\"https:\/\/github.com\/googleapis\/java-logging-logback\" target=\"_blank\" rel=\"noopener\">here<\/a> &#8211;&nbsp;https:\/\/github.com\/googleapis\/java-logging-logback.<\/p>\n<p>Adding the appender is easy, a logback.xml file with the appender configured looks like this:<\/p>\n<div>\n<pre class=\"brush:java\">&lt;configuration&gt;\n    &lt;appender name=\"gcpLoggingAppender\" class=\"com.google.cloud.logging.logback.LoggingAppender\"&gt;\n    &lt;\/appender&gt;\n    &lt;root level=\"INFO\"&gt;\n        &lt;appender-ref ref=\"gcpLoggingAppender\"\/&gt;\n    &lt;\/root&gt;\n&lt;\/configuration&gt;<\/pre>\n<\/div>\n<p>This works great, but it has a huge catch. It requires connectivity to a GCP environment as it writes the logs directly to Cloud Logging system, which is not ideal for local testing.&nbsp;<\/p>\n<p>An approach that works when running in a GCP environment as well as locally is to simply direct the output to Standard Out, this will ensure that the logs are written in a json structured format and shipped correctly to Cloud Logging.<\/p>\n<div>\n<pre class=\"brush:java\">&lt;configuration&gt;\n    &lt;appender name=\"gcpLoggingAppender\" class=\"com.google.cloud.logging.logback.LoggingAppender\"&gt;\n        &lt;redirectToStdout&gt;true&lt;\/redirectToStdout&gt;\n    &lt;\/appender&gt;\n    &lt;root level=\"INFO\"&gt;\n        &lt;appender-ref ref=\"gcpLoggingAppender\"\/&gt;\n    &lt;\/root&gt;\n&lt;\/configuration&gt;<\/pre>\n<\/div>\n<p>If you are using Spring Boot as the framework, the approach can be even be customized such that on a local environment the logs get written to Standard Out in a line by line manner, and when deployed to GCP, the logs are written as Json output:<\/p>\n<div>\n<pre class=\"brush:java\">&lt;configuration&gt;\n    &lt;include resource=\"org\/springframework\/boot\/logging\/logback\/defaults.xml\"\/&gt;\n    &lt;include resource=\"org\/springframework\/boot\/logging\/logback\/console-appender.xml\"\/&gt;\n\n    &lt;appender name=\"gcpLoggingAppender\" class=\"com.google.cloud.logging.logback.LoggingAppender\"&gt;\n        &lt;redirectToStdout&gt;true&lt;\/redirectToStdout&gt;\n    &lt;\/appender&gt;\n\n    &lt;root level=\"INFO\"&gt;\n        &lt;springProfile name=\"gcp\"&gt;\n            &lt;appender-ref ref=\"gcpLoggingAppender\"\/&gt;\n        &lt;\/springProfile&gt;\n        &lt;springProfile name=\"local\"&gt;\n            &lt;appender-ref ref=\"CONSOLE\"\/&gt;\n        &lt;\/springProfile&gt;\n    &lt;\/root&gt;\n&lt;\/configuration&gt;<\/pre>\n<\/div>\n<h2 class=\"wp-block-heading\">This Works..But<\/h2>\n<p>Google Cloud logging appender works great, however there is an issue. It doesn&#8217;t capture the entirety of a stack trace for some reason. I have an<br \/><a href=\"https:\/\/github.com\/googleapis\/java-logging-logback\/issues\/758\" target=\"_blank\" rel=\"noopener\">issue open<\/a> which should address this. In the meantime if capturing the full stack in the logs is important then a different approach is to simply write a json formatted log using the native json layout provided by logback:<\/p>\n<div>\n<pre class=\"brush:java\">&lt;appender name=\"jsonLoggingAppender\" class=\"ch.qos.logback.core.ConsoleAppender\"&gt;\n    &lt;layout class=\"ch.qos.logback.contrib.json.classic.JsonLayout\"&gt;\n        &lt;jsonFormatter class=\"ch.qos.logback.contrib.jackson.JacksonJsonFormatter\"&gt;\n        &lt;\/jsonFormatter&gt;\n        &lt;timestampFormat&gt;yyyy-MM-dd HH:mm:ss.SSS&lt;\/timestampFormat&gt;\n        &lt;appendLineSeparator&gt;true&lt;\/appendLineSeparator&gt;\n    &lt;\/layout&gt;\n&lt;\/appender&gt;<\/pre>\n<\/div>\n<p>The fields however does not match the<br \/><a href=\"https:\/\/cloud.google.com\/logging\/docs\/structured-logging\" target=\"_blank\" rel=\"noopener\">structured log format<\/a> recommended by GCP, especially the severity, a quick tweak can be made by implementing a custom JsonLayout class that looks like this:<\/p>\n<div>\n<pre class=\"brush:java\">package org.bk.logback.custom;\n\nimport ch.qos.logback.classic.Level;\nimport ch.qos.logback.classic.spi.ILoggingEvent;\nimport ch.qos.logback.contrib.json.classic.JsonLayout;\nimport com.google.cloud.logging.Severity;\n\nimport java.util.Map;\n\npublic class GcpJsonLayout extends JsonLayout {\n    private static final String SEVERITY_FIELD = \"severity\";\n\n    @Override\n    protected void addCustomDataToJsonMap(Map&lt;String, Object&gt; map, ILoggingEvent event) {\n        map.put(SEVERITY_FIELD, severityFor(event.getLevel()));\n    }\n\n    private static Severity severityFor(Level level) {\n        return switch (level.toInt()) {\n            \/\/ TRACE\n            case 5000 -&gt; Severity.DEBUG;\n            \/\/ DEBUG\n            case 10000 -&gt; Severity.DEBUG;\n            \/\/ INFO\n            case 20000 -&gt; Severity.INFO;\n            \/\/ WARNING\n            case 30000 -&gt; Severity.WARNING;\n            \/\/ ERROR\n            case 40000 -&gt; Severity.ERROR;\n            default -&gt; Severity.DEFAULT;\n        };\n    }\n}<\/pre>\n<\/div>\n<p>which takes care of mapping to the right Severity levels for Cloud Error reporting.&nbsp;<\/p>\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n<p>Use Google Cloud Logback appender and you should be set. Consider the alternate approaches only if you think you are lacking more of the stacktrace.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Biju Kunjummen, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/www.java-allandsundry.com\/2022\/05\/google-cloud-structured-logging-for.html\" target=\"_blank\" rel=\"noopener\">Google Cloud Structured Logging for Java Applications<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;One advice for logging that I have seen when targeting applications to cloud platforms is to simply write to Standard Out and platform takes care of sending it to the appropriate log sinks. This mostly works except when it doesn&#8217;t &#8211; it especially doesn&#8217;t when analyzing failure scenarios. Typically for Java applications this means looking &hellip;<\/p>\n","protected":false},"author":236,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-113994","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Google Cloud Structured Logging for Java Applications - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Structured Logging? Check our article presenting the Google Cloud Structured Logging for Java Applications\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Google Cloud Structured Logging for Java Applications - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Structured Logging? Check our article presenting the Google Cloud Structured Logging for Java Applications\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-19T04:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Biju Kunjummen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Biju Kunjummen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html\"},\"author\":{\"name\":\"Biju Kunjummen\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/802eedfe6f17c3c13fa656af46b6b0e5\"},\"headline\":\"Google Cloud Structured Logging for Java Applications\",\"datePublished\":\"2022-05-19T04:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html\"},\"wordCount\":616,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html\",\"name\":\"Google Cloud Structured Logging for Java Applications - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2022-05-19T04:00:00+00:00\",\"description\":\"Interested to learn about Structured Logging? Check our article presenting the Google Cloud Structured Logging for Java Applications\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2022\\\/05\\\/google-cloud-structured-logging-for-java-applications.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Google Cloud Structured Logging for Java Applications\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/802eedfe6f17c3c13fa656af46b6b0e5\",\"name\":\"Biju Kunjummen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/66af1504c76f011746c89812efce168850f07dce91ce881e62795e10c99d30b3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/66af1504c76f011746c89812efce168850f07dce91ce881e62795e10c99d30b3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/66af1504c76f011746c89812efce168850f07dce91ce881e62795e10c99d30b3?s=96&d=mm&r=g\",\"caption\":\"Biju Kunjummen\"},\"sameAs\":[\"http:\\\/\\\/biju-allandsundry.blogspot.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Biju-Kunjummen\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Google Cloud Structured Logging for Java Applications - Java Code Geeks","description":"Interested to learn about Structured Logging? Check our article presenting the Google Cloud Structured Logging for Java Applications","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html","og_locale":"en_US","og_type":"article","og_title":"Google Cloud Structured Logging for Java Applications - Java Code Geeks","og_description":"Interested to learn about Structured Logging? Check our article presenting the Google Cloud Structured Logging for Java Applications","og_url":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2022-05-19T04:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Biju Kunjummen","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Biju Kunjummen","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html"},"author":{"name":"Biju Kunjummen","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/802eedfe6f17c3c13fa656af46b6b0e5"},"headline":"Google Cloud Structured Logging for Java Applications","datePublished":"2022-05-19T04:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html"},"wordCount":616,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html","url":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html","name":"Google Cloud Structured Logging for Java Applications - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2022-05-19T04:00:00+00:00","description":"Interested to learn about Structured Logging? Check our article presenting the Google Cloud Structured Logging for Java Applications","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2022\/05\/google-cloud-structured-logging-for-java-applications.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Google Cloud Structured Logging for Java Applications"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/802eedfe6f17c3c13fa656af46b6b0e5","name":"Biju Kunjummen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/66af1504c76f011746c89812efce168850f07dce91ce881e62795e10c99d30b3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/66af1504c76f011746c89812efce168850f07dce91ce881e62795e10c99d30b3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/66af1504c76f011746c89812efce168850f07dce91ce881e62795e10c99d30b3?s=96&d=mm&r=g","caption":"Biju Kunjummen"},"sameAs":["http:\/\/biju-allandsundry.blogspot.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/Biju-Kunjummen"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/113994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/236"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=113994"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/113994\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=113994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=113994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=113994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}