Thanks joe for bringing up this issue. This is a good catch for a won't fix. :-)
2016-11-05 20:54 GMT+01:00 Dominik Psenner (JIRA) <j...@apache.org>: > > [ https://issues.apache.org/jira/browse/LOG4NET-281?page= > com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] > > Dominik Psenner closed LOG4NET-281. > ----------------------------------- > Resolution: Won't Fix > Assignee: Dominik Psenner > > Extension methods are the road to be taken here. Everything else makes the > API awkward. Anyway I'm closing this issue because extension classes with > custom log levels / method names should be implemented by whoever needs > them and they do not have to be part of the core logging framework. The > logging framework cannot assume what priorities log levels that "Alert", > "Emergency" should have and even if we could, it would start a never ending > story. > > > Insufficient Granularity on Log methods in ILog > > ----------------------------------------------- > > > > Key: LOG4NET-281 > > URL: https://issues.apache.org/jira/browse/LOG4NET-281 > > Project: Log4net > > Issue Type: New Feature > > Components: Core > > Affects Versions: 1.2.10 > > Environment: All Environments > > Reporter: Zev > > Assignee: Dominik Psenner > > Fix For: 1.3.0 > > > > Original Estimate: 2h > > Remaining Estimate: 2h > > > > The driver for this change is that we are unable to log certain event > types from the ILog object. While we can use the Logger object, it is > easier to have them here. > > updated code: > > ILog.cs > > //start new > > void Emergency(object message); > > void Emergency(object message, Exception e); > > void Alert(object message); > > void Alert(object message, Exception e); > > void Critical(object message); > > void Critical(object message, Exception e); > > void Notice(object message); > > void Notice(object message, Exception e); > > //end new > > LogImpl.cs (in ReloadLevels) > > //start new > > m_levelEmergency = levelMap.LookupWithDefault( > Level.Emergency); > > m_levelAlert = levelMap.LookupWithDefault(Level.Alert); > > m_levelCritical = levelMap.LookupWithDefault( > Level.Critical); > > m_levelNotice = levelMap.LookupWithDefault(Level.Notice); > > //end new > > methods: > > //start new > > virtual public void Emergency(object message) > > { > > Logger.Log(ThisDeclaringType, m_levelEmergency, message, > null); > > } > > virtual public void Emergency(object message, Exception > exception) > > { > > Logger.Log(ThisDeclaringType, m_levelEmergency, message, > exception); > > } > > virtual public void Alert(object message) > > { > > Logger.Log(ThisDeclaringType, m_levelAlert, message, null); > > } > > virtual public void Alert(object message, Exception exception) > > { > > Logger.Log(ThisDeclaringType, m_levelAlert, message, > exception); > > } > > virtual public void Critical(object message) > > { > > Logger.Log(ThisDeclaringType, m_levelCritical, message, > null); > > } > > virtual public void Critical(object message, Exception exception) > > { > > Logger.Log(ThisDeclaringType, m_levelCritical, message, > exception); > > } > > virtual public void Notice(object message) > > { > > Logger.Log(ThisDeclaringType, m_levelNotice, message, null); > > } > > virtual public void Notice(object message, Exception exception) > > { > > Logger.Log(ThisDeclaringType, m_levelNotice, message, > exception); > > } > > //end new > > private fields: > > //start new > > private Level m_levelEmergency; > > private Level m_levelAlert; > > private Level m_levelCritical; > > private Level m_levelNotice; > > //end new > > > > -- > This message was sent by Atlassian JIRA > (v6.3.4#6332) > -- Dominik Psenner