# How to disable LibPQ error messages being printed to console

**URL:** <https://discourse.julialang.org/t/how-to-disable-libpq-error-messages-being-printed-to-console/68101>\
**Category:** General Usage\
**Created:** [September 13, 2021, 2:59pm UTC](https://discourse.julialang.org/t/how-to-disable-libpq-error-messages-being-printed-to-console/68101 "2021-09-13T14:59:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laco\_Kovac](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laco_kovac/32/20684_2.png) [@Laco\_Kovac](https://discourse.julialang.org/u/Laco_Kovac)\
**Post date:** [September 13, 2021, 2:59pm UTC](https://discourse.julialang.org/t/how-to-disable-libpq-error-messages-being-printed-to-console/68101/1 "2021-09-13T14:59:44Z")

</div>

LibPQ is printing error messages to the console, even though it is expected to fail and I don’t want these messages to show up in the console.

I looked for some LibPQ option(s), but didn’t find anything suitable.

Or would it be possible somehow redirect printout to temporary stream before LibPQ execute call and after redirect it back?

Any suggestion is welcome. Thank you,

---

<div class="post-metadata">

**Author:** ![Laco\_Kovac](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laco_kovac/32/20684_2.png) [@Laco\_Kovac](https://discourse.julialang.org/u/Laco_Kovac)\
**Post date:** [September 14, 2021, 12:46pm UTC](https://discourse.julialang.org/t/how-to-disable-libpq-error-messages-being-printed-to-console/68101/2 "2021-09-14T12:46:05Z")

</div>

I tried to use [Suppressor](https://github.com/JuliaIO/Suppressor.jl). As soon as it hit @suppress line, it threw ErrorException(“type TeeLogger has no field stream”)

I tried following code

```julia
redirect_stdout(open(tempname(), "w")) do
    redirect_stderr(open(tempname(), "w")) do
        executeResult = execute(conn, query)
    end
end

```

It didn’t help at all; LibPQ is still printing error(s) to the console…
