Skip to content
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 logging to file #1452

Closed
wants to merge 1 commit into from
Closed

Conversation

LarsOL
Copy link
Contributor

@LarsOL LarsOL commented Sep 10, 2015

Add log4net as a extension in visual studio project file.
Add logging to file "log.txt"

@LarsOL
Copy link
Contributor Author

LarsOL commented Sep 10, 2015

Used this tutorial: https://stackoverflow.com/questions/9805281/writing-logs-to-file
We may need to tweak the config file, currently at debug lvl it fills up the logs very quickly.
maybe 5MB max file size and 3 log backups?

@LarsOL
Copy link
Contributor Author

LarsOL commented Sep 10, 2015

Oh something is broken, ill have a look

@pjf
Copy link
Member

pjf commented Sep 10, 2015

Ahoy, and welcome! Logging is something I adore, so I'm delighted to see this PR! :)

We may need to tweak the config file, currently at debug lvl it fills up the logs very quickly.

At debug level we're supposed to produce lots of output, and is most useful when we turn on debug for individual classes (or usually in my case, for individual tests in our test suite).

Currently by default we show the user everything with warn and above, although you can start CKAN with the --verbose or --debug switches to lower that to info and debug respectively.

I definitely like the ability for us to be able to log to files, although I wouldn't have this start anywhere more detailed than info, which will hopefully capture important operations without an immensity of spam.

(I haven't yet looked at the commit itself; I may have more feedback once I've done so.)

Many thanks again!

~ Paul

@LarsOL
Copy link
Contributor Author

LarsOL commented Sep 10, 2015

Currently it logs to whatever switch is enabled. All i have really done is enable the config file and pointed it to a default one i found in the above link.

Once it is set up properly you should be able to configure everything to do with log4net in that file. From my brief overview the log4net config format is extremely flexible, so it should be a matter of editing that file only for logging changes and not having to edit the code much anymore.

@@ -32,6 +32,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the error in mono, It can't parse this line (repeated for each project file). But this was generated by Visual Studio so i am hesitant to edit it back without knowing what all of it does?

Anyone with more expertise than me tell me if its fine to change back to:
<Reference Include="log4net">

@Olympic1
Copy link
Member

Try adding this line in the .csproj files between <Reference> and <HintPath> and see if that works <SpecificVersion>False</SpecificVersion>

@Olympic1 Olympic1 added Enhancement GUI Issues affecting the interactive GUI Cmdline Issues affecting the command line labels Feb 28, 2016
@ayan4m1
Copy link
Contributor

ayan4m1 commented Sep 3, 2016

Lars, I have a rebased branch that contains file logging using a log4net config and some other upstream changes - if you'd like to rebase this and continue working on it, feel free, but if you don't have the time/wherewithal with it or we get the other PR merged in I will close this out to keep things tidy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmdline Issues affecting the command line Enhancement GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants