# Posting logs of underlying plugin libraries to Logstash log stream

**URL:** <https://discuss.elastic.co/t/posting-logs-of-underlying-plugin-libraries-to-logstash-log-stream/327105>\
**Category:** Logstash\
**Created:** [March 6, 2023, 4:10pm UTC](https://discuss.elastic.co/t/posting-logs-of-underlying-plugin-libraries-to-logstash-log-stream/327105 "2023-03-06T16:10:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alromos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alromos/32/112383_2.png) [@alromos](https://discuss.elastic.co/u/alromos)\
**Post date:** [March 6, 2023, 4:10pm UTC](https://discuss.elastic.co/t/posting-logs-of-underlying-plugin-libraries-to-logstash-log-stream/327105/1 "2023-03-06T16:10:43Z")

</div>

Is it possible to post logs of underlying libraries to Logstash log stream?

For instance, I use **input JDBC plugin** with **MSSQL JDBC driver** and I would like to see logs of the driver library for debug purposes.

Is it possible? I haven't found any related articles on the net.

I want to note that MSSQL JDBC driver librart relies on **java.util.logging (JUL)** while Logstash utilizes **Log4j2** for internal logging purposes.

So, in any case I will need to set up a logging bridge.

---

<div class="post-metadata">

**Author:** ![alromos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alromos/32/112383_2.png) [@alromos](https://discuss.elastic.co/u/alromos)\
**Post date:** [March 13, 2023, 11:15am UTC](https://discuss.elastic.co/t/posting-logs-of-underlying-plugin-libraries-to-logstash-log-stream/327105/2 "2023-03-13T11:15:16Z")

</div>

I've managed to solve the issue on my own with the steps below.  
I'm using 8.5.1 version of Logstash as Docker image.

1. Add [Apache Log4j JUL Adapter](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-jul/2.20.0) JAR to `/opt/logstash/logstash-core/lib/jars/`.
2. Set the system property `java.util.logging.manager` to `org.apache.logging.log4j.jul.LogManager`. I did it with the following command in Dockerfile: `ENV LS_JAVA_OPTS -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager`
3. Add required logging configuration to `/opt/logstash/config/log4j2.properties` file. In my case I just added the 2 lines to enable `FINER` logging for `com.microsoft.sqlserver.jdbc.internals.SQLServerConnection` class:

```auto
logger.sqlserverconnection.name = com.microsoft.sqlserver.jdbc.internals.SQLServerConnection
logger.sqlserverconnection.level = trace

```

Steps 1 and 2 were taken from [the Apache guide](https://logging.apache.org/log4j/2.x/log4j-jul.html).

---

<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:** [April 10, 2023, 11:16am UTC](https://discuss.elastic.co/t/posting-logs-of-underlying-plugin-libraries-to-logstash-log-stream/327105/3 "2023-04-10T11:16:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
