Is there any way to disable color in the error log...
# troubleshooting
s
Is there any way to disable color in the error logs? Or maybe just do the normal Python error logging rather than the fancy version? That information is unreadable in my production logs anyway and it would be easier to figure out what’s wrong with simpler error logs.
v
I think so but I don't know how https://docs.meltano.com/guide/logging#logging If you spend the time and get a good
logging.yaml
for this please share. I honestly dislike the colors and formatting even in my dev environment
s
I’ve got one of those that turns off all coloring. However, when there are errors, I still get the coloring codes
I don’t really like the fancy error logs either. I once saw that it printed all my ENV vars, including my secrets, which was a surprise 😱
v
if you're running in DEV mode Meltano will, but by default that doesn't happen from Meltano
t
I’ll make a note on https://github.com/meltano/meltano/issues/6482 about your request @sterling_paramore but a thumbsup on the issue would be great too 🙂
s
What specifically is DEV mode?
v
I meant DEBUG mode sorry
maybe
logging.yaml
is setting the log level to DEBUG? Depends on your setup?
s
Nope, I’m only doing logging at INFO level. I don’t think that the log level affects how errors are reported to the log
v
I haven't experienced that myself
t
@florian.hines will you chime in here when you get a free moment?
f
Meltano cli also spits out output that by passes logging completely and sometimes writes colored output (like when theres an error). I'm guessing thats what you're seeing.
@aaronsteers @edgar_ramirez_mondragon any easy ways to disable clicks colorized output ?
was hoping it might respect NO_COLOR but that doesn't seem to be the case.
e
But seems easy to add at the command group level
f
We force a color more often than i realized tbh - https://github.com/meltano/meltano/search?q=fg%3D
e
Yup, but setting the
color
attribute of the click context to
False
should prevent even those from printing colored output
s
Ok, so it looks like meltano is using the rich library for error formatting, which does respect the
NO_COLOR
variable.
f
@ken_payne is working on supporting toggleable pretty printing of exceptions which leverages
rich
. But I'm guessing what you're see'ing is just colorized click.secho output.
s
🤦 Just realized that yes,
NO_COLOR
does indeed disable color in the error logs. However, it still uses some kind of grayscale for highlighting and thus does not remove the annoying color codes!!!
message has been deleted
a
We were just discussing this and making an action plan. My understanding is that
NO_COLOR
should remove color codes. Admittedly there's still more to do. I've added a comment to also check on greyscale codes but please chime in here with comments/suggestions: https://github.com/meltano/meltano/issues/6482#issuecomment-1234671360
k
@sterling_paramore what version of Meltano is your screenshot of? As Florian mentioned, I am working on a PR that adds rich as a dependency (I believe for the first time), but it hasn't merged yet 🤔 Is there any chance you have rich in your environment alongside Meltano? Much of my work has been focused on turning rich off in all the relevant places when it isn't needed, specifically because structlog defaults to rich if it finds it installed 🤦‍♂️
s
Using
meltano==2.5.0
.
rich==12.51
was installed as dependency of
typer==0.6.1
as a dependency of
dagster-cloud==1.0.6
a
@sterling_paramore - Is it safe to assume from the above that means that
dagster
and
meltano
are both installed on the same python environment or that you are not using python virtual environments? If Meltano is installed with
pipx install meltano
, I would the Meltano bits to be kept separate from other installed libraries - but would be good to confirm.
And also, in the next version of Meltano, we'll be adding formal support for
rich
anyway, including the ability to disable it (if needed) when non-color output is requested. WIP here.
s
Yes, they’re both in the same containerized Python environment. I presumed that
pipx
was mostly for developer convenience
a
Actually
poetry
is the Dev-focused tool but
pipx
is really for all application-type installations.
The quick and simple summary: 1.
poetry
for local dev (if you want to 🙂 ) 2.
pipx
to install "programs" like meltano 3.
pip
basically never, unless you know you won't have conflicts or you don't care about them.
The great thing about pipx is that it's basically interchangeable with pip for most use cases, but it automatically keeps each python installation separate from all the others.
s
But I’m used to having a requirements.txt file to pin the versions of all my dependencies.
So…. I guess here I would install dagster and all the python deps I need for other dagster things (including
pipx
). And then have a separate
RUN pipx install meltano==2.5.0
that would install the meltano application in my conatiner? I current have dagster running meltano via python methods that run shell commands.
a
Yeah, this would work: 1. Install dagster 2. Install pipx 3. Install meltano (with pipx, or manually in a virtualenv) You could also manually create the virtual environment if you prefer to not use
pipx
.- but it's just generally easier to have
pipx
manage the virtual environments for you.
Another option is: 1.
pip install meltano
(or
pipx install meltano
) 2.
meltano install dagster
(Meltano will automatically create a virtualenv for you if it has a plugin definition and a `pip_url`for dagster) When working in containerized environments, you basically get the first program installed directly with
pip
free from worrying about conflicts. The second app you install, though, will need to be in a virtual env if you want to be sure they don't conflict.
s
That worked!
Copy code
COPY requirements/requirements-eta_wh.txt /requirements-eta_wh.txt
RUN pip install --upgrade pip
RUN pip install --ignore-installed -r /requirements-eta_wh.txt && rm -rf /root/.cache

# This instead of `pipx ensurepath`
ENV PATH=$PATH:/root/.local/bin

# Install meltano in a separate python environment via recommended pipx
RUN pipx install meltano==2.5.0
No more extremely verbose fancy colored error logging!
a
🙌 🎉
Great to hear it!
s
Thanks for your help!
a
Np. This was a tricky one. Glad it got worked out!