Skip to content
log4js-node supports Koa-middleware
Branch: v2.x
Clone or download
Latest commit c129c9e Dec 15, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore update 2.x log4js to 2.3.x Nov 18, 2017
LICENSE Initial commit Apr 20, 2016 Update Apr 20, 2016
koa-logger.js Merge pull request #10 from SunilWang/v2.x Nov 18, 2017
package.json 2.3.2 Dec 15, 2018


A wrapper for log4js-node which support Koa logger middleware. Log message is forked from Express (Connect) logger file.


This branch is use to Koa v2.x. To use Koa v0.x & v1.x, please check the master branch.


for koa v0.x & v1.x

$ npm i --save koa-log4@1

for koa v2.x

$ npm i --save koa-log4@2

The default logger is for koa v2.x

$ npm i --save koa-log4


Config koa-log4js is same as the original log4js-node.

Normal log4js way

This way is same as the original log4js-node.

const log4js = require('koa-log4')

const log = log4js.getLogger('index')'index do some awesome things')

Koa-middleware way

Similar to use Express (Connect) logger middleware.

const log4js = require('koa-log4')
app.use(log4js.koaLogger(log4js.getLogger("http"), { level: 'auto' }))

Full Example

Check this repo for full example with Koa v2.


See here for more info.

You can’t perform that action at this time.