Hello Kishu,
Please kindly note that the article that you provided does not have examples of structured logging. You can look into these documents instead for Structured Logging explanation and for an example on how to write structured logs. For more information on different payload formats please look into this document LogEntry. That being said, please use jsonPayload instead of StringPayload in order to log JSON data into your logs in Stackdriver Logging.
Hello Kishu,
I would like to confirm that you are using the example outlined in your initial link and have replaced StringPayload with JsonPayload?
If that is the case, it would be my recommendation to utilise the actual JsonPayload code offered here instead. The code from your original post is appropriate for StringPayload as JsonPayload requires its own specific import. You can find the imports required for this at the following example offered on GitHub.
However, I am still unsure of what you are trying to achieve. Stackdriver logging for Standard produces the following logs:
Request Logs- records requests that are sent to all App engine Apps (Type: Request Log).
App Logs- record activity within the App Engine app (Type: LogLine).
Third-party package logs- package logs that are included in Logs Viewer.
Based on this provided information, I would like to know where you intend these logs to go. (i.e: Request Logs or App logs specifically). You had mentioned you are seeing LogLines. I am assuming you are trying to publish logs within App Logs at this point.
If that is the case then it would be my recommendation to follow the guidelines expressed here for writing application logs. Note: you will notice that the guide mentions the import of the Java.Util library which is different than the cloud import required for Request logs.
As for your last question of “is structured logging possible in standard environment?”. I would like to inform you that JsonPayload is essentially Structured Logging. However if this not what you are expecting then I would have to request an example of what you want the log to look like.