Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log levels not accounted for in Log Viewer #59

Closed
ddykhoff opened this issue May 11, 2018 · 6 comments
Closed

Log levels not accounted for in Log Viewer #59

ddykhoff opened this issue May 11, 2018 · 6 comments
Assignees
Labels
api: logging Issues related to the googleapis/nodejs-logging-bunyan API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ddykhoff
Copy link

Environment details

  • OS: Windows 10
  • Node.js version: 10.0.0
  • npm version: 6.0.1
  • @google-cloud/logging-bunyan version: 0.8.1

Steps to reproduce

import { LoggingBunyan } from '@google-cloud/logging-bunyan';
import * as bunyan from 'bunyan';

const cloudLogger: LoggingBunyan = new LoggingBunyan();

export default bunyan.createLogger({
  name: 'messaging',
  streams: [
    {stream: process.stdout, level: 'info'},
    cloudLogger.stream('info')
  ]
});

Use Application Default Credentials.
Deploy to App Engine flex environment.

Resulting logs in Log Viewer are all put under the 'any' log level (i.e. logger.info, logger.warn, logger.error are ignored). Error objects logged to logger.error do appropriately show up in Error Reporting correctly.

image

@ofrobots ofrobots added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels May 11, 2018
@ofrobots
Copy link
Contributor

ofrobots commented May 11, 2018

Thanks for reporting. Confirmed bug. This was reported internally earlier this week as well.

It seems that we are missing the severity field missing from the LogEntry :

{
 insertId:  "..........pX_9QkRCK0wQgqvSWRgW9B"  
 jsonPayload: {
  hostname:  "localhost"   
  level:  30   
  message:  "bunyan.info"   
  name:  "my-bunyan-name"   
  pid:  6   
  time:  "Tue May 08 2018 04:15:48 GMT+0000 (UTC)"   
  v:  0   
 }
 logName:  "-obfuscated-"  
 receiveTimestamp:  "2018-05-08T04:15:50.923833984Z"  
 resource: {
  labels: {
   module_id:  "test-cloud-logging"    
   project_id:  "-obfuscated-"    
   version_id:  "20180507t210614"    
  }
  type:  "gae_app"   
 }
 timestamp:  "2018-05-08T04:15:48.401000022Z"  
}

We will be looking at this shortly.

ofrobots added a commit to ofrobots/nodejs-logging-bunyan that referenced this issue May 12, 2018
ofrobots added a commit to ofrobots/nodejs-logging-bunyan that referenced this issue May 12, 2018
ofrobots added a commit that referenced this issue May 14, 2018
@ghost ghost removed the priority: p2 Moderately-important priority. Fix may not be included in next release. label May 14, 2018
@QuestionAndAnswer
Copy link

QuestionAndAnswer commented May 18, 2018

I'm seeing that fix has been merged, but I'm still receiving version with wrong line even after fresh installation.

image

Could you please verify published package?

This issue, with missing severity, seeing both locally and on deployed application. That is why I'm asking to check is this fix has been publish.

@ofrobots
Copy link
Contributor

Hi @QuestionAndAnswer we haven't published a release with this fix just. We will notify this thread once a release has been published.

@ofrobots
Copy link
Contributor

The fix should be available via the v0.8.2 release.

@QuestionAndAnswer
Copy link

Thanks. Working.

@google-cloud-label-sync google-cloud-label-sync bot added the api: logging Issues related to the googleapis/nodejs-logging-bunyan API. label Jan 31, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
@samcfinan
Copy link

I think this issue has reemerged. Using v3.0.1 and experiencing the same behavior as the above poster. All logs appear as default.

Initialization:

const streams: Stream[] = [{ stream: process.stdout, level: 'info' }]

const logger = bunyan.createLogger({
  name: 'invintory-api',
  streams,
  serializers: stdSerializers,
})

if (envIsHosted()) {
  const gcpLogger = new LoggingBunyan()
  streams.push(gcpLogger.stream('info'))
}

export default logger

Example log:

{
  "insertId": "l4a45qxpqq7rroz7m",
  "jsonPayload": {
    "method": "GET",
    "requestID": "771e850b-8132-41a9-99ab-30650c34a626",
    "v": 0,
    "msg": "",
    "path": "/health",
    "pid": 37,
    "level": 30,
    "name": "redacted",
    "body": {},
    "query": {},
    "hostname": "redacted"
  },
  "resource": {
    "type": "gae_app",
    "labels": {
      "module_id": "default",
      "version_id": "20210207t022501",
      "zone": "",
      "project_id": "redacted"
    }
  },
  "timestamp": "2021-02-07T18:53:24.450Z",
  "labels": {
    "compute.googleapis.com/resource_id": "redacted",
    "appengine.googleapis.com/instance_name": "redacted",
    "compute.googleapis.com/zone": "us-central1-c",
    "compute.googleapis.com/resource_name": "redacted"
  },
  "logName": "redacted",
  "receiveTimestamp": "2021-02-07T18:53:29.468290729Z"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/nodejs-logging-bunyan API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants