I have been looking into implementing logging on my DNN 7+ site. I would like to have a configurable logging level such as that provided with log4net.
I attempted to follow the instructions to integrate log4net found on the DNN site here, http://www.dnnsoftware.com/community-.... After adding the reference and the line of code to use the logging:
DnnLog.Info("My Logging Worked!");
The code reported a warning that reads:
'DotNetNuke.Instrumentation.DnnLog' is obsolete: '"Depreciated in 7.0.1 due to poor performance, use LoggerSource.Instance"'
I am having a hard time finding information about the right way to do things. It appears that "DnnLog" has been replaced with a similar class to interact with log4net called "DnnLogger". One of the differences with using this class (and the "LoggerSource" class) is that logging is no longer accomplished using static methods.
The "GetLogger()" function used to retrieve the logger instance takes some parameters and I have not yet been able to find any documentation describing the appropriate usage. The DNN source has plenty of examples. From these examples it looks like the appropriate usage is to supply the current class. Inside a file "MyClass.cs" that declares a class "MyClass" it appears the following would be correct:
ILog logger = LoggerSource.Instance.GetLogger(typeof(MyClass));
or
DnnLogger logger = DnnLogger.GetLogger("MyClass");
What logger is returned by the first line of code that uses the typeof()? By this I mean, will this logger then be using the log4net settings configured for the site? If it isn't using the log4net settings, where are the log files saved and where are configuration settings adjusted? The nerd in me wants to know exactly what is happening with the typeof() class parameter, why is it used?
If the first example does not connect with log4net (or something that allows a configurable easy to use logging level), is the second option the way to go? If so, what is the appropriate string to be passing? "MyClass" was my guess but I could not confirm.
If I am totally off track here and should be approaching this from another direction please feel free to chime in with suggestions.
Thanks a lot everyone!