# Enable logging in the plugin ruby script

**URL:** <https://discuss.elastic.co/t/enable-logging-in-the-plugin-ruby-script/27335>\
**Category:** Logstash\
**Created:** [August 13, 2015, 2:47pm UTC](https://discuss.elastic.co/t/enable-logging-in-the-plugin-ruby-script/27335 "2015-08-13T14:47:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rishi](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rishi](https://discuss.elastic.co/u/rishi)\
**Post date:** [August 13, 2015, 2:47pm UTC](https://discuss.elastic.co/t/enable-logging-in-the-plugin-ruby-script/27335/1 "2015-08-13T14:47:35Z")

</div>

I wanted to enable logging in my plugin ruby script and added the following line in the `register` method:

```auto
LogStash::Logger.setup_log4j(@logger)

```

I have the log4j and the slf4j jars in my runtime dependencies. When I try to start logstash, I get an error

```auto
The error reported is: 
  missing class name (`org.apache.log4j.LogManager')

```

Any idea what configuration I am missing?

---

<div class="post-metadata">

**Author:** ![rishi](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rishi](https://discuss.elastic.co/u/rishi)\
**Post date:** [August 13, 2015, 4:28pm UTC](https://discuss.elastic.co/t/enable-logging-in-the-plugin-ruby-script/27335/2 "2015-08-13T16:28:09Z")

</div>

The jars were not getting packaged because they were not _committed_ into the repo. I am no longer getting this error but the log statements are not printing. Do I need to package the log4j.properties file too?

EDIT: Guess I just had to change the default log level

```auto
@logger.level = "DEBUG"

```

---

<div class="post-metadata">

**Author:** ![dnmanh](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@dnmanh](https://discuss.elastic.co/u/dnmanh)\
**Post date:** [June 10, 2016, 2:36pm UTC](https://discuss.elastic.co/t/enable-logging-in-the-plugin-ruby-script/27335/3 "2016-06-10T14:36:14Z")

</div>

Hi Rishi,

I have same problem. Have you found the solution?

Best regards,

Manh

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:53am UTC](https://discuss.elastic.co/t/enable-logging-in-the-plugin-ruby-script/27335/4 "2017-07-06T04:53:36Z")

</div>


