# How to debug kong plugin?

**URL:** <https://discuss.konghq.com/t/how-to-debug-kong-plugin/1248>\
**Category:** General\
**Created:** [June 11, 2018, 9:20am UTC](https://discuss.konghq.com/t/how-to-debug-kong-plugin/1248 "2018-06-11T09:20:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![videni](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/videni/32/374_2.png) [@videni](https://discuss.konghq.com/u/videni)\
**Post date:** [June 11, 2018, 9:21am UTC](https://discuss.konghq.com/t/how-to-debug-kong-plugin/1248/1 "2018-06-11T09:21:00Z")

</div>

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.

handler.lua

```lua

function ApiStats:access(conf)
     breakhere()
    ApiStats.super.log(self)

    local ok, err = buffer.init({
        host = conf.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
    end

    ApiStats.setupFlushHandler()

    local point = influxdb_point(ngx, conf)
    buffer.buffer(point)

    return true, point
end

```

---

<div class="post-metadata">

**Author:** ![darrenjennings](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/darrenjennings/32/203_2.png) [@darrenjennings](https://discuss.konghq.com/u/darrenjennings)\
**Post date:** [June 11, 2018, 9:08pm UTC](https://discuss.konghq.com/t/how-to-debug-kong-plugin/1248/2 "2018-06-11T21:08:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![videni](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/videni/32/374_2.png) [@videni](https://discuss.konghq.com/u/videni)\
**Post date:** [June 12, 2018, 2:59am UTC](https://discuss.konghq.com/t/how-to-debug-kong-plugin/1248/3 "2018-06-12T02:59:33Z")

</div>

thanks, I see that error in kong error log.
