-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to change debug flags in freetds.conf #535
Comments
I'm having the same issue in a Rails app in a Kubernetes container. I've set
I noticed that it seems to start the logging in 0x4fff, and never seems to pickup the change in the freetds.conf file. Does a build option need to be passed in the Gemfile, or a Rails db config setting updated? |
sorry for the late reply. @djberg96 the TDS version in the Please note that regarding the initial issue by @KarimElsayad247, I have to double-check, but usually you set the configuration location with |
@andyundso We're using the activerecord sqlserver adapter (Rails 7.1 app btw), not tiny_tds directly. And I was just tinkering with the version based on your README, it didn't seem to have any effect anyway, so by default it's set to auto. As for the location, it does seem to be picking it up as expected from FREETDSCONF and FREETDS_DIR. If there's some other env variable I should set, I'd be interested to know what it is. Are you able to set a custom log file and reduct the logging level to something lower like 0x80? If so, how do you do it? |
... that kind of aligns with freetds that there are sometimes multiple options to achieve the same :) to be honest, I did not play around with logging anything out of FreeTDS directly, but can do so in the next days. Out of curiosity: What are you trying to solve / find out that you need extensive debug logs? |
I was getting strange database timeout errors and other oddities happening at one point in our kubernetes development cluster, and I wanted to see what the heck was happening under the hood. Since there was an option to specify an explicit tds log file, I added it to our helm chart. But, the full logging is not that useful to me, way too much information, so I wanted to tone it down. |
@djberg96 @KarimElsayad247 I played around with the debug logs when invoking
In this file I wrote:
This gave me a log file with timestamps, network packages, from where things were called plus all errors and warnings:
So I say generally messing with the debug flags of FreeTDS should work. However, I would assume you need to restart your Rails app when changing values in the @djberg96 if you need different information, this page lists the different Hex values what activates what and this page has a hex calculator to properly add things up. |
I think I tried setting it as low as 0x08 and it still seemed to be giving me full info. I tried restarting the rails server, but it had no effect. Maybe I need to restart the container. |
@djberg96 probably. Given that FreeTDS wrote one log file for my entire test, I would assume changes are only picked up when a new process spawns. If that does not help, let me know. I can try to spin up a local app here with MSSQL to see if it behaves differently. |
At the moment within the Dockerfile I'm doing |
@djberg96 If I install
so likely you need something like this: sed -i 's/;\s*debug flags = 0xffff/\tdebug flags = 0x08/' /etc/freetds/freetds.conf |
I would recommend to copy the |
Ah, I didn't know the semicolons were also comment markers! I thought it was just some sort of newline delimiter. However, even after removing them (as well as whatever example stuff it slapped in there), it still seems to be doing full logging. But, I also realized I don't know what sort of logging I should expect at different levels. I couldn't find any sample output for information level 1 vs information level 2 vs warning, etc. |
so I tried out customizing the debug logs with an app inside Docker. I used a toy application of mine, which was not meant to run with MSSQL (uses SQLite for the solid stack and virtual columns), but I managed to hack together something that runs in Docker. The relevant commit where I passed the FreeTDS conf and customized the debug level is here. and this works perfectly fine, warning level is really quiet:
so I conclude, that passing a custom |
Before submitting an issue please check these first!
Environment
Operating System
TinyTDS Version and Information
FreeTDS Version
freetds v1.1.24
Description
So I was trying to debug a particular issue, and for that I wanted to reduce the noise in freetds.log, and it didn't seem like my changes were picked up.
setting
debug flags = 0x80
in/usr/local/etc/freetds.conf
doesn't do anything, same withdump file
After some digging I found that TinyTDS simpley ignores freetds.conf, and changing anything there has no effect.
My question then becomes: how do I configure log level for freetds when I'm using tinytds?
The text was updated successfully, but these errors were encountered: