How to debug kong plugin?

I have enabled my custom plugin successfully, but I have no way to know whether it is executed it no not.

my plugin is enabled globally

the access method of the handler should execute when a request received , but even though I add a none existed method breakhere, no error happened.


function ApiStats:access(conf)

    local ok, err = buffer.init({
        host =,
        port = conf.port,
        proto = conf.proto,
        db = conf.db,
        auth = conf.username and conf.password and conf.username.. ":" ..conf.password or Nil

    if (not ok) then
        ngx.log(ngx.ERR, err)
        return false


    local point = influxdb_point(ngx, conf)

    return true, point

are you getting logs when you run ngx.log instead of breakhere() (wondering if your plugin is even executing this file)? If you are editing the files and looking for immediate feedback, you will need to restart Kong with each code change.

thanks, I see that error in kong error log.

1 Like