adonisjs / core

AdonisJS is a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more.
https://adonisjs.com
MIT License
17.03k stars 636 forks source link

Logger level other than info and debug do not work #960

Closed alex-maxime closed 6 years ago

alex-maxime commented 6 years ago

Hello

I was playing and exploring the config of adonis. and i found a strange behavior when i want to change the Logger level with the config file with other value than, info or debug

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 127.0.0.1:3333
    at Server.setupListenHandle [as _listen2] (net.js:1335:14)
    at listenInCluster (net.js:1383:12)
    at doListen (net.js:1509:7)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:236:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:560:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1362:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:560:3)

There is nothing listening on 127.0.0.1:3333

Put info or debug make the server start

Packages version

"dependencies": {
    "@adonisjs/ace": "^5.0.4",
    "@adonisjs/ally": "^2.0.5",
    "@adonisjs/auth": "^3.0.6",
    "@adonisjs/bodyparser": "^2.0.4",
    "@adonisjs/cors": "^1.0.6",
    "@adonisjs/drive": "^1.0.4",
    "@adonisjs/fold": "^4.0.9",
    "@adonisjs/framework": "^5.0.7",
    "@adonisjs/http-logger": "^1.0.0",
    "@adonisjs/ignitor": "^2.0.7",
    "@adonisjs/lucid": "^6.1.0",
    "@adonisjs/lucid-slugify": "^1.0.3",
    "@adonisjs/mail": "^3.0.8",
    "@adonisjs/persona": "^1.0.5",
    "@adonisjs/session": "^1.0.26",
    "@adonisjs/shield": "^1.0.7",
    "@adonisjs/validator": "^5.0.3"
  }

Node.js and npm version

node --version : v10.6.0 npm --version : v6.4.1

My Logger config

logger: {
    /*
    ...
    */
    transport: 'console',

    /*
    ...
    */
    console: {
      driver: 'console',
      name: 'graphql-app',
      level: 'notice' // Only work with debug or info
    },

    /*
    ...
    */
    file: {
      driver: 'file',
      name: 'graphql-app',
      filename: 'graphqlserver.log',
      level: 'info'
    }
  },

How to reproduce

With the sample project just follow those steps :

npm i -g @adonisjs/cli
adonis new yardstick
cd yardstick
# edit config/app.js 
# to change
#    console: {
#      driver: 'console',
#      name: 'adonis-app',
#      level: 'warning'   <= you can put 'emerg',  'alert',  'crit',  'error',  'warning',  'notice', 
#                                 The server will crash on start
#    }
nano config/app.js
adonis serve --dev
thetutlage commented 6 years ago

Works fine for me and unable to reproduce. Make sure that port is not busy

alex-maxime commented 6 years ago

Hum, the port is free But I have found why. I am using graphql stack withsubscriptions-transport-ws on the server and the client, The client try to reconnect (WebSocket), refetch (http) to server. and it happens when i restart the server.

to avoid this, First i have to shutdown the client, then restart the server.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.