hapijs / good

hapi process monitoring
Other
525 stars 160 forks source link

good-logs do not occur when starting my server #527

Closed ignivaravinderrikhi closed 7 years ago

ignivaravinderrikhi commented 7 years ago

I am new to good, previously I was simply using console.log to know the control flow of my application, I wanted an automatic logger, don't know if it is one or not. Please excuse me if it is a silly issue, but I installed good, good-squeez and good-console

"good": "7.0.2", "good-console": "6.1.2", "good-squeeze": "5.0.0"

the plugin options are

var goodOptions = { ops: { interval: 1000 }, reporters: { myConsoleReporter: [{ module: 'good-squeeze', name: 'Squeeze', args: [{ log: '*', response: '*', request: '*' }] }, { module: 'good-console' }, 'stdout'] } }; & registered it like this { register : require('good'), goodOptions }

but when I start my server, I see no logs , Please Help me out, I am a novice to the process

Marsup commented 7 years ago

Can you provide a more complete code containing the registration and start of the server ?

ignivaravinderrikhi commented 7 years ago

@Marsup Sure good-gist

Server is working fine but i can't see any logs on my console

Current node version is v6.3.1, hapi version is 15.2.0

arb commented 7 years ago

Are you running this on a VM like docker or something or is this running locally on your machine? Are you sure the server is starting and not erroring out somewhere else?

ignivaravinderrikhi commented 7 years ago

I am running this locally and Server is also working fine, as all the routes are performing okay . Is there a possibility of a version mismatch ???

arb commented 7 years ago

Are you still having issues here?

nicolasiscoding commented 7 years ago

Hey Arb, I am also having this issue. Trying Hapi.js for the first time and this is my attempt at getting logging working:

const LoggerOptions = {
  myConsoleReporter: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ log: '*', response: '*', request: '*' }]
          },

          {
            module: 'good-console'
          },
          'stdout'
    ]
};

...
...
...

server.register([{
    register: Inert
  }, {
    register: Good,
    LoggerOptions
  }], (err) => {
    if (err) {
      console.error(err);
    }

    server.route(Routes);

    server.start(() => {
          console.info(`Server running at: ${server.info.uri}`);
        });
  });

and versioning from package.json

    "good": "^7.1.0",
    "good-console": "^6.2.0",
    "good-squeeze": "^5.0.1",
    "hapi": "^16.1.0",

No logging occurs even when I run from straight command line like node server.js

arb commented 7 years ago

Are you doing anything that should be logged in those routes? Nothing in that code should write to the good logging stream.

nicolasiscoding commented 7 years ago

When I hit my standard homepage route (GET on a '/')  I do not see any logging in my console

On Tue, Jan 17, 2017 at 10:42 AM -0500, "Adam Bretz" notifications@github.com wrote:

Are you doing anything that should be logged in those routes? Nothing in that code should write to the good logging stream.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

JulianHi commented 7 years ago

@ignivaravinderrikhi @nicolasiscoding

i had the same problem... there seems to be an error in the documentation

& registered it like this { register : require('good'), goodOptions }

change to:

& registered it like this { register : require('good'), options: goodOptions }

that solved at least my problem.

nicolasiscoding commented 7 years ago

@JulianHi, Thank you so much! The smallest of typos can create the biggest of headaches!

arb commented 7 years ago

@ignivaravinderrikhi this issues is several months old with no new comments from you. If you are still having issues, please open a new issue.

WebMatrixware commented 7 years ago

This is a non-issue in that the plugin functions correctly, but it is a huge issue that your documentation is still wrong. How are users supposed to use your plugin if you cannot even document how to use it correctly?

arb commented 7 years ago

Where is the documentation incorrect?

WebMatrixware commented 7 years ago

@ignivaravinderrikhi @nicolasiscoding

i had the same problem... there seems to be an error in the documentation

& registered it like this { register : require('good'), goodOptions } change to:

& registered it like this { register : require('good'), options: goodOptions } that solved at least my problem.

And from the documentation example on the home page...

server.register({
    register: require('good'),
    options,
}

which does not work, it should be

server.register({
    register: require('good'),
    options: options,
}
arb commented 7 years ago

It works fine using Node 4.x.x which has been stipulated as the minimum version good's package.json file. This is object short hand notation and was introduced in Node 4.

WebMatrixware commented 7 years ago

I am running node 6.10.1 which is the current stable version and it does not work there. I would also point out that since at least the other two posters in this feed had the same issue this is clearly not an isolated fluke.

arb commented 7 years ago

Any PR to help clarify or improve documentation are always welcomed. Thanks for your interest in this project.