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
Add log4net.xml, refactor logging init and log to file by default #1881
Conversation
So if I'm understanding this, by default this will not change anything, but if a log4net.xml exists, it'll use that, so we can tweak logging to get just the useful logging output for debugging purposes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds fine, tests fine, runs fine. Code all looks good to me.
Our Travis builds are failing since this was merged, on the "prove" step. It appears we are turning debug logging on by default somehow? |
Ah, I see why - because we are logging to the console during builds, there is more output from the "version" CLI command than just the version number. The test scripts are checking the output against a regex to make sure the version string looks correct, which it doesn't because there is more text being output than just the version string. My thought is that the test is kinda weak but obviously the functionality has changed which may be undesirable. Let me know how you want to proceed. |
Well, the trouble is that when you run any command, you get debugging level of logging, which shouldn't be the default.
The command is supposed to return a line like this:
But all we get at the end of a bunch of debug lines is:
And the test is looking for the string "version" I'm not sure why that is. I don't understand why it's doing that, and it shouldn't. It isn't including the INFO level note "Debug logging enabled" that is inserted when the --debug option is detected, either. The default logging fallback should not be DEBUG level |
I wrote the new log init to fallback if no log4net.xml was found in the current working directory, I'm thinking that is why some installs are DEBUG level by default. The log4net.xml isn't an embedded resource but I think it's possible to package it inside the CKAN binary and reference it from there. That way we are directly controlling the desired log level from inside the binary. I'll open a new PR if that sounds good to you. |
The logging initialization has been condensed into one class which will either load config from a log4net.xml in the app startup directory, or failing to find one tries to initialize the existing basic logging system. All of the logging entry points have been refactored to call this
Logging.Initialize()
method.Tests are passing in the Windows/VS environment, review and feedback appreciated.
This would resolve #1452, which unfortunately has some project changes that are risky and needs a rebase.