Hi Daniel,
first of all, thank you for this hint.
My goal is to use my simple ILog interface (as i sketched) from the
application code and to get the logger by calling ILog logger =
LogManager.GetLogger(typeof( typeof<current class>));
I would like to get this according to the current class because I want to
controll the logging intensity on namespace level. I also would like to
avoid the config-files / or use these only in case of problems for remote
debúgging.
I had a look at ILogger but I did not find out how to get this ILogger.
There is an interface to get a logger according to a string (name?) via
ILoggerRepository. But when I call LogManager.GetRepository and then
rep.GetCurrentLoggers() there are no loggers defined... The documentation
did not help me.
Thank you
Alex
Daniel Marohn wrote:
>
>> private log4net.ILog _log;
>
> I think this line is wrong. You use an Implementation of ILog for your
> wrapper. This implementation will do the same checks, your
> Implementation does and it sets the locationinfo onto your position
> (from the point of the _log instance, your code is doing the logging).
> Change the type to ILogger and log Messages like this:
>
> private readonly static Type ThisDeclaringType = typeof(MyLog);
> virtual public void Debug(object message, Exception exception)
> {
> Logger.Log(ThisDeclaringType, m_levelDebug, message,
> exception);
> }
> virtual public void DebugFormat(string format, params object[]
> args)
> {
> if (IsDebugEnabled)
> {
> Logger.Log(ThisDeclaringType, m_levelDebug, new
> SystemStringFormat(CultureInfo.InvariantCulture, format, args), null);
> }
> }
>
>
--
View this message in context:
http://www.nabble.com/Wrapping-Log4Net-tp24551728p24580218.html
Sent from the Log4net - Users mailing list archive at Nabble.com.